When using 'range' option the output video is unreadable
stevewirig opened this issue · 1 comments
When I run the following, I get a functioning mp4 video that lasts for 2 seconds then freezes for the remaining 5 seconds (original YT video is 7 seconds, 300kb):
ytdl(url, { filter: function(format) { return format.container === 'mp4'; }, range:"0-85714", quality:
"highest" })
.pipe(fs.createWriteStream('video.mp4'));
When I run this:
ytdl(url, { filter: function(format) { return format.container === 'mp4'; }, range:"42857-85714", quality:
"highest" })
.pipe(fs.createWriteStream('video.mp4'));
I would expect to get an mp4 with 1 second duration starting from the offset of 1 second. The files size looks correct in that it is returning the appropriate number of bytes, but I believe the video is not getting its duration / dimension meta data and is not playable.
Am I doing something wrong?
range is meant to be used to get a partial file, it's meant to be used as way to pause/continue a download. not to slice a video. I don't know if there's a video encoding that can break up the time in a video by breaking up the video file itself.
also thanks for reminding me to put the range option back.