ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.3k stars 9.95k forks source link

Download range #622

Open raducostea opened 11 years ago

raducostea commented 11 years ago

Hi,

Is there any way to implement a download range? To download starting from 1m 30 to 1m 50?

Thanks

phihag commented 11 years ago

This is request is more complex than it sounds:

All, in all, this is quite complex, but certainly doable. Feel free to contribute patches or pull request, even for the individual steps.

raducostea commented 11 years ago

Hi,

I've tried to implement the Byte Range and it worked but of course the video will not play. Probably i need to reassemble the sequence somehow

phihag commented 11 years ago

Feel free to submit a pull request for the byte range. It's far easier to integrate code in small steps than all at once, and others may chip in.

sahin commented 11 years ago

hi guys,

this feature is super important for us. any updates on this issue?

shaybracha commented 11 years ago

Hi How could I Download bytes-ranges via youtube-dl?

Thanks

yasoob commented 11 years ago

@shaybracha today its too late. I will see tomorrow and will tell you. :+1:

shaybracha commented 11 years ago

@yasoob thanks...waiting for your answer

yasoob commented 11 years ago

Sorry I was not able to do it today because my laptop broke :( okay you will have to use an external script to get the bytes value.make your own python script. You can import youtube-dl and extract the info then you can use requests with stream=true to get the byte range . This is the procedure. However I will post the complete code in 1 or 2 days after I get my laptop repaired. Thanx for your patience. On 1 Jul 2013 11:38, "shaybracha" notifications@github.com wrote:

@yasoob https://github.com/yasoob thanks...waiting for your answer

— Reply to this email directly or view it on GitHubhttps://github.com/rg3/youtube-dl/issues/622#issuecomment-20265446 .

JaySandhu commented 9 years ago

This is fairly easy to accomplish with ffmpeg. Example:

ffmpeg -ss (start time) -i (direct video link) -t (duration you need) -c:v copy -c:a copy (title.mp4)

You can get the direct link by using the --get-url option.

I don't know this projects feelings on adding (optional) dependancies, but this would be trivial to implement provided ffmpeg (compiled with open-ssl) is available. If adding the dependency is not an option, then, as I'm sure you're all aware, this is a pretty mammoth task.

Users who have ffmpeg installed can use method this in the meantime.

mk-fg commented 9 years ago

For current twitch.tv VoDs, byte-range is not necessarily needed, as they are split into 4-second chunks, and m3u8 playlist specifies all the chunk lengths precisely (e.g. #EXTINF:3.240,), so if ~4s seek precision is tolerable (which it probably is) - it's only a matter of running through playlist to pick the links needed.

I did write a proof-of-concept script for that here, and it seem to work nicely, except for some sequential download performance issues, which kinda rule-out downloading whole thing with ffmpeg directly. Did a write-up on on the whole process here.

roberto68 commented 8 years ago

@JaySandhu please provide some complete example: cause I did this: ffmpeg -ss 14350 -i https://www.youtube.com/watch?v=mMZriSvaVP8 --get-url -t 11200 -c:v copy -c:a copy react-spot.mp4 and it did not work.

JaySandhu commented 8 years ago

@roberto68 Sorry for the confusion, to get a direct link to the video you need to use youtube-dl's --get-url option. Then, with a direct video link from youtube-dl, you can use ffmpeg as described above.

Example: youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8

Then with the link: ffmpeg -ss 14350 -i (link) -t 11200 -c:v copy -c:a copy react-spot.mp4

One line version: ffmpeg -ss 14350 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=mMZriSvaVP8) -t 11200 -c:v copy -c:a copy react-spot.mp4

You can either pick a format with both video and audio (such as -f 22), or you can use ffmpeg to combine a DASH audio and video stream. You'll need to make sure you're ffmpeg build includes open-ssl (so that it can download the video over https).

roberto68 commented 8 years ago

thanks JaySandhu, now it's workin right way :)

angular-tools commented 8 years ago

I can give it a try to implement this feature.. Right now when I tried to skip the video, youtube sent a request shown below. I then tried downloading the link directly with wget and I also got a file of about 500 KB but it did not play in VLC, KMPlayer, MPlayer, etc. So maybe there is another missing piece?

Link: https://r3---sn-ci5gup-cvhz.googlevideo.com/videoplayback?initcwndbps=365000&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AE1c25o1pRu61sxBCZWQksq3ixkGB_Uqtl2xKDhs1LUa&sver=3&ip=106.221.136.162&mv=m&mt=1456387095&ms=au&fexp=3300134%2C3300164%2C3311882%2C3312381%2C3312529%2C9405186%2C9408497%2C9413141%2C9416126%2C9418200%2C9419451%2C9420452%2C9422342%2C9422596%2C9423661%2C9423662%2C9425283%2C9425790%2C9427107%2C9427422%2C9428649%2C9428710%2C9429072%2C9429597&dur=11346.869&upn=M38qsT9uuVg&mn=sn-ci5gup-cvhz&mm=31&source=youtube&signature=D0FD6BB2BD5E82C7B882813C552C06EDBDCE2A82.1E85213F62C2E69F4FCEA7D7E87B8BC9D00CB7E8&lmt=1418940170813485&ipbits=0&key=yt6&itag=247&mime=video%2Fwebm&clen=2245741091&pl=21&keepalive=yes&requiressl=yes&expire=1456408861&gir=yes&cpn=TR7wBJmFEBEkwtVX&alr=yes&ratebypass=yes&c=WEB&cver=html5&range=415184135-417218639&rn=28&rbuf=31205

Params:

initcwndbps:365000
sparams:clen,dur,gir,id,initcwndbps,ip,ipbits,itag,keepalive,lmt,mime,mm,mn,ms,mv,pl,requiressl,source,upn,expire
id:o-AE1c25o1pRu61sxBCZWQksq3ixkGB_Uqtl2xKDhs1LUa
sver:3
ip:106.221.126.162
mv:m
mt:1456387095
ms:au
fexp:3300134,3300164,3311882,3312381,3312529,9405186,9408497,9413141,9416126,9418200,9419451,9420452,9422342,9422596,9423661,9423662,9425283,9425790,9427107,9427422,9428649,9428710,9429072,9429597
dur:11346.869
upn:M38qsT9uuVg
mn:sn-ci5gup-cvhz
mm:31
source:youtube
signature:D0FD6BB2BD5E82C7B882813C552C06EDBDCE2A82.1E85213F62C2E69F4FCEA7D7E87B8BC9D00CB7E8
lmt:1418940170813485
ipbits:0
key:yt6
itag:247
mime:video/webm
clen:2245741091
pl:21
keepalive:yes
requiressl:yes
expire:1456408861
gir:yes
cpn:TR7wBJmFEBEkwtVX
alr:yes
ratebypass:yes
c:WEB
cver:html5
range:415184135-417218639
rn:28
rbuf:31205

can someone give me any pointers from their earlier research on this to hep me?

jaredscheib commented 8 years ago

Anyone ever figure this one out? Sending range or begin params doesn't work for me, curious if anyone has found a working solution?

markvdb commented 8 years ago

/me would also be interested.

johnhawkinson commented 7 years ago

Whoops, sorry for the dupe. Although in #12347 I asked:

I realize we can sort of achieve this today by passing args to ffmpeg, e.g. youtube-dl ... --external-downloader ffmpeg --external-downloader-args '-ss 3718.538 -t 60' or perhaps as a postprocessor arg where appropriate. But that's not very user-friendly, and knowing when to choose an external downloader versus a postprocessor may not be obvious.

I guess maybe this could just be a FAQ entry, but I think some options would be a better goal.

Can we get some interim documentation in the absence of a real user-oriented feature?

yan12125 commented 7 years ago

There are already quite a few such cases (workarounds for missing features), and I guess they will make README.md even more bloated. IMO it's enough to listed them in relevant issues. Your comment will definitely benifit those who need it.

johnhawkinson commented 7 years ago

Fair enough. Although I found it tough to find this Issue. I did in fact search before filing a new one, although obviously not extremely hard :)

ghost commented 7 years ago
ffmpeg -ss 14350 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=videoId) > -t 11200 -c:v copy -c:a copy output.mp4

Was looking for this feature to be able to download a time segment from a video. Is @JaySandhu's 2015 answer still one of the better ways to do this or does youtube-dl support this feature in any way? Don't get me wrong, it's a great answer, I was just curious to see if anyone was aware of current developments seeing how this issue is still open even after 4 years.

johnhawkinson commented 7 years ago

I believe there has not been any change.

rEes9P commented 7 years ago

I'd like to follow @JaySandhu's suggestion but am lost and would greatly appreciate some help!

Let's take this link, of which I would like the first 29 minutes and 54 seconds, as an example: https://www.youtube.com/watch?v=2QPbriKs_sI&list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0&index=2

When I try to get the url of the file via the --get-url option I get this:

youtube-dl --get-url https://www.youtube.com/watch?v=2QPbriKs_sI&list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0&index=2 [1] 1322 [2] 1323 [2]+ Done list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0 users-MacBook-Pro:~ user$ https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&pcm2cms=yes&ei=fsKGWeyGLcONowO8xIP4AQ&mm=31&pl=20&mn=sn-8vq54voxpo-5hql&initcwndbps=1352500&ms=au&mv=m&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&key=dg_yt0&signature=224CB1B319564531CA1819805C9EFF3848A9C801.3AC4B5B275625FF0F5D2F6D49F756CDEA4ADCB67&mt=1502003750&ip=42.106.43.220&ipbits=0&expire=1502025438&sparams=ip,ipbits,expire,id,itag,source,requiressl,pcm2cms,ei,mm,pl,mn,initcwndbps,ms,mv,ratebypass,mime,gir,clen,lmt,dur https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?mime=audio%2Fwebm&keepalive=yes&source=youtube&pcm2cms=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&itag=251&expire=1502025437&gir=yes&mm=31&mn=sn-8vq54voxpo-5hql&dur=36000.000&mt=1502003750&mv=m&ms=au&lmt=1498650272424607&clen=526461218&ip=42.106.43.220&key=yt6&ipbits=0&id=o-AJqnSngI1EXKktmEmtNUt0nvM1QwU2pjCTI-SU2tFwEj&ei=fcKGWevQLMnYowPh_qvQBQ&initcwndbps=1352500&pl=20&signature=15B982263BA7D44D7F0FDF9B8D167076E35F8882.2547270D7467DEA9FF6DF36E9A9841061073558D&requiressl=yes&ratebypass=yes

[1]+ Done youtube-dl --get-url https://www.youtube.com/watch?v=2QPbriKs_sI

Please, please help with the following!

1. I am very confused by the output of the --get-url command. Which of these urls do I use?! And what do the [1], [2], [3] and "+ Done" signify? I suspect that I am getting the 2 urls (the ones in the huge chunks) because the audio and video streams are not combined. How do I go about using ffmpeg to combine DASH audio and video streams, as Jay suggests?

2. Do I need to use : or leading zeroes in the timestamp? How do I distinguish 20 seconds from 2 minutes for the (duration you need) portion?

3. Will this command download the entire video and then crop out the portion I want or would it just download the requested portion?

rEes9P commented 7 years ago

Thanks for weighing in, @siddht4. Wouldn't requesting f -22 download the 720p version, which is the best version with both audio and video?

139          m4a        audio only DASH audio   82k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 204.18MiB
249          webm       audio only DASH audio   97k , opus @ 50k, 188.44MiB
250          webm       audio only DASH audio  111k , opus @ 70k, 249.28MiB
171          webm       audio only DASH audio  161k , vorbis@128k, 464.74MiB
140          m4a        audio only DASH audio  162k , m4a_dash container, mp4a.40.2@128k (44100Hz), 545.28MiB
251          webm       audio only DASH audio  170k , opus @160k, 502.07MiB
160          mp4        256x144    DASH video  242k , avc1.4d400c, 25fps, video only, 310.34MiB
278          webm       256x144    144p  303k , webm container, vp9, 25fps, video only, 379.01MiB
133          mp4        426x240    DASH video  377k , avc1.4d4015, 25fps, video only, 776.09MiB
242          webm       426x240    240p  444k , vp9, 25fps, video only, 734.48MiB
243          webm       640x360    360p  675k , vp9, 25fps, video only, 1.36GiB
134          mp4        640x360    DASH video  764k , avc1.4d401e, 25fps, video only, 1.63GiB
244          webm       854x480    480p 1022k , vp9, 25fps, video only, 2.53GiB
135          mp4        854x480    DASH video 1390k , avc1.4d401e, 25fps, video only, 3.42GiB
247          webm       1280x720   720p 2035k , vp9, 25fps, video only, 5.38GiB
136          mp4        1280x720   DASH video 2755k , avc1.4d401f, 25fps, video only, 7.39GiB
248          webm       1920x1080  1080p 3608k , vp9, 25fps, video only, 10.03GiB
137          mp4        1920x1080  DASH video 4589k , avc1.640028, 25fps, video only, 15.78GiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

I would like to get the best audio and the best video (in this case 137 - 1920x1080 (DASH video)+251 - audio only (DASH audio)) and let ffmpeg mix the two.

I'm not clear as to what @JaySandhu's means when he mentions the --get-url command. Would ffmpeg -ss 0 -i $(youtube-dl https://www.youtube.com/watch?v=2QPbriKs_sI) > -t 1794 -c:v copy -c:a copy output.mp4 not work?

rEes9P commented 7 years ago

Thanks @siddht4. My ffmpeg version is 3.3.3.

I'm sorry but I don't follow what you said! Could you please list the command I would use to get the best versions of audio and video and get ffmpeg to combine them?

I like how youtube-dl automatically mixes the two if ffmpeg is present :-)

rEes9P commented 7 years ago

I still don't get it :-( I would like the best audio + best video but restricted to the first 29 minutes and 54 seconds. Many thanks for your continued help!

rEes9P commented 7 years ago

How can I use Jay's method without f -22 and with the best audio + video but restricted to the time portion I want?

If I use the command that you posted earlier ffmpeg -ss 0 -i $(youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=2QPbriKs_sI) > -t 1794 -c:v copy -c:a copy output.mp4 but without the -f 22 so, ffmpeg -ss 0 -i $(youtube-dl --get-url https://www.youtube.com/watch?v=2QPbriKs_sI) > -t 1794 -c:v copy -c:a copy output.mp4, I get the following message in Terminal in red text with a black background.

[NULL @ 0x7fbca1802600] Unable to find a suitable output format for 'https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?signature=8F8A97319A40FA3E51A25E09F13BD38D3249DD6B.0159BD0D26CD4678858582AE1323D4B4122A5C01&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=zweHWfb7NI3AowO_yIq4Bw&itag=251&id=o-AAlFlG-RRe0xpK9AJI-FxVEre2XwhXs_n2druqsjsUzM&ipbits=0&mm=31&mn=sn-8vq54voxpo-5hql&initcwndbps=1380000&clen=526461218&pcm2cms=yes&ip=42.106.36.28&ms=au&mt=1502021495&mv=m&dur=36000.000&gir=yes&keepalive=yes&expire=1502043184&lmt=1498650272424607&key=yt6&mime=audio%2Fwebm&pl=20&source=youtube&ratebypass=yes' https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?signature=8F8A97319A40FA3E51A25E09F13BD38D3249DD6B.0159BD0D26CD4678858582AE1323D4B4122A5C01&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=zweHWfb7NI3AowO_yIq4Bw&itag=251&id=o-AAlFlG-RRe0xpK9AJI-FxVEre2XwhXs_n2druqsjsUzM&ipbits=0&mm=31&mn=sn-8vq54voxpo-5hql&initcwndbps=1380000&clen=526461218&pcm2cms=yes&ip=42.106.36.28&ms=au&mt=1502021495&mv=m&dur=36000.000&gir=yes&keepalive=yes&expire=1502043184&lmt=1498650272424607&key=yt6&mime=audio%2Fwebm&pl=20&source=youtube&ratebypass=yes: Invalid argument

Also, trying out the command that you first posted (the one with -f 22) results in this error

[NULL @ 0x7fed06803400] Unable to find a suitable output format for '1794' 1794: Invalid argument

JaySandhu commented 7 years ago

The --get-url option just prints a direct link to the video instead of downloading it.

The complication is that YouTube serves its highest quality content through separate video and audio sources, so youtube-dl's --get-url provides you with two links, one is video and the other is audio. In my previous comment I recommended people use -f 22, which is the best quality source (720p) that has both video and audio, but sometimes that's not available, or you would prefer the best quality version. For that use:

youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' --get-url (youtube link)

To get the urls of the best video and audio sources. Then to combine them with ffmpeg:

ffmpeg -ss (start time) -i (top link) -i (bottom link) -t (duration you need) -c:v copy -c:a copy (title.mp4)

@rEes9P to answer your questions in order:

  1. The output of your --get-url command is a bit screwy because your forgot to put the link in quotes, so the & in the link is being interpreted by bash causing the command to run in the background and leading to a bunch of job control related output - the [1], [2], [3] and "+ Done" part. Also, remove the playlist part of the link else youtube-dl will print links to the entire playlist. The revised command: youtube-dl --get-url "https://www.youtube.com/watch?v=2QPbriKs_sI". That should lead to a more parseable output, but you'll still have two links, you can combine them with ffmpeg as mentioned above.

  2. You can provide timestamps in the format hh:mm:ss or just as an integer in seconds. so 20 seconds would be 00:00:22 or just 22 and 2 minutes would be 00:02:00 or 120.

  3. This will not download the entire video, only the range you request.

rEes9P commented 7 years ago

@JaySandhu - This is brilliant! Thank you so, so much for the clear and concise instructions.

Hrxn commented 7 years ago

?

How should this be implemented? It depends on the shell, platform, etc..

yan12125 commented 7 years ago

For those who want to work on this, please check #8851 first. Discussions here only applies to plain file-based streams. That is, a single file contains the whole video and/or audio stream. Fragmented streams (HLS/DASH/HDS/ISM) should be handled differently. We can implement this for file-based streams first, in which the implementation should check whether a given video URL is file-based or not.

There are two possible approaches for file-based streams, ffmpeg-based post convertor or website-dependent URL transformer (ex: &start=xxx for YouTube). The former should be included in the proposed implementation for generality, and the latter can be added as an extra feature.

ghost commented 7 years ago

@JaySandhu, thanks for coming back to this issue. I saw your info about the timestamps usable in the -ss flag. Does the -t flag have to be in seconds, or can it be in hh:mm:ss as well?

Hrxn commented 7 years ago

Both use the same syntax, across all of ffmpeg. https://www.ffmpeg.org/ffmpeg-utils.html#Time-duration

ghost commented 7 years ago

Thank you @Hrxn.

rEes9P commented 7 years ago

@JaySandhu - The --get-url part works perfectly after I took out the playlist bit of the url and put the quotes in where appropriate. However, I'm having some trouble with the ffmpeg -ss (start time) -i (top link) -i (bottom link) -t (duration you need) -c:v copy -c:a copy (title.mp4) bit. Could you please have a look and let me know where I'm going wrong?

Here's the command I used

ffmpeg -ss 00 -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=42.106.36.220&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur” -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=42.106.36.220&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes” -t 00:01:04 -c:v copy -c:a copy test.mp4

And here's what happened

users-MacBook-Pro:~ user$ ffmpeg -ss 00 -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=42.106.36.220&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur” -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=42.106.36.220&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes” -t 00:01:04 -c:v copy -c:a copy test.mp4 [1] 1797 [2] 1798 [3] 1799 [4] 1800 [5] 1801 [6] 1802 [7] 1803 [8] 1804 [9] 1805 [10] 1806 [11] 1807 [12] 1808 [13] 1809 [14] 1810 [15] 1811 [16] 1812 [17] 1813 [18] 1814 [19] 1815 [20] 1816 [21] 1817 [22] 1818 [23] 1819 [24] 1820 [25] 1821 [26] 1822 -bash: -i: command not found [27] 1823 [28] 1824 [29] 1825 [30] 1826 [31] 1827 [32] 1828 [33] 1829 [34] 1830 [35] 1831 [36] 1832 [37] 1833 [38] 1834 [39] 1835 [40] 1836 [41] 1837 [42] 1838 [43] 1839 [44] 1840 [45] 1841 [46] 1842 [47] 1843 [48] 1844 -bash: -t: command not found [2] Done itag=137 [3] Done source=youtube [4] Done requiressl=yes [5] Done ei=KhyIWb3MLNT4oAPI2o6oDA [6] Done mm=31 [7] Done initcwndbps=1307500 [8] Done mv=m [9] Done ms=au [10] Done mn=sn-8vq54voxpo-5hql [11] Done pl=20 [12] Done ratebypass=yes [13] Done mime=video/mp4 [14] Done gir=yes [15] Done clen=16938851529 [16] Done lmt=1498521946448697 [17] Done dur=36000.000 [18] Done mt=1502092202 [19] Done key=dg_yt0 [20] Done signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E [21] Done ip=42.106.36.220 [22] Done ipbits=0 [23] Done expire=1502113930 [24] Exit 127 sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur” -i “https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire [25] Done lmt=1498650272424607 [26] Done ipbits=0 [27] Done requiressl=yes [28] Done source=youtube [29] Done initcwndbps=1307500 [30] Done keepalive=yes [31] Done ei=KRyIWe-ND8OAowPhz6fYCA [32] Done clen=526461218 [33] Done dur=36000.000 [34] Done key=yt6 [35] Done mime=audio%2Fwebm [36] Done ip=42.106.36.220 [37] Done mm=31 [38] Done mn=sn-8vq54voxpo-5hql [39] Done expire=1502113929 [40] Done itag=251 [41] Done pl=20 [42] Done gir=yes [43] Done signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A [44] Done id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7 [45] Done mt=1502092202 [46] Done mv=m [47]- Done pcm2cms=yes [48]+ Done ms=au users-MacBook-Pro:~ user$ ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.1.0 (clang-802.0.42) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --host-ldflags= --enable-chromaprint --enable-ffplay --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopus --enable-librtmp --enable-librubberband --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100

I am particularly perplexed by the -bash: -i: command not found and -bash: -t: command not found bits. Many, many thanks for all your help!

johnhawkinson commented 7 years ago

@rEes9P, you are using curly quotes. You must use straight quotes. Type the quotation mark into the terminal by hand, don't copy/paste it.

rEes9P commented 7 years ago

@johnhawkinson - Ah, thanks for that. You can tell that I am new to this!

I replaced the curly quotes so:

ffmpeg -ss 00 -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=42.106.36.220&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur" -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=42.106.36.220&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes" -t 00:01:04 -c:v copy -c:a copy test.mp4

However, I am now getting this (error in bold at the end):

fmpeg -ss 00 -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=42.106.36.220&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur" -i "https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&lmt=1498650272424607&ipbits=0&requiressl=yes&source=youtube&initcwndbps=1307500&keepalive=yes&ei=KRyIWe-ND8OAowPhz6fYCA&clen=526461218&dur=36000.000&key=yt6&mime=audio%2Fwebm&ip=42.106.36.220&mm=31&mn=sn-8vq54voxpo-5hql&expire=1502113929&itag=251&pl=20&gir=yes&signature=58051D10D2468DE05B4636609C9C2C03E40B50BC.4A76CA4B114D52A55588AB3B35521BB8D0EFA14A&id=o-AI3-NsFb5zK3MD-gr4Fcbkh66Vqw4E_ezwWT8vLMIRC7&mt=1502092202&mv=m&pcm2cms=yes&ms=au&ratebypass=yes" -t 00:01:04 -c:v copy -c:a copy test.mp4 ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.42.1) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --host-ldflags= --enable-chromaprint --enable-ffplay --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopus --enable-librtmp --enable-librubberband --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2_1/include/openjpeg-2.1 --enable-nonfree --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 [https @ 0x7fa399593540] HTTP error 403 Forbidden https://r4---sn-8vq54voxpo-5hql.googlevideo.com/videoplayback?id=d903dbae22acfec2&itag=137&source=youtube&requiressl=yes&ei=KhyIWb3MLNT4oAPI2o6oDA&mm=31&initcwndbps=1307500&mv=m&ms=au&mn=sn-8vq54voxpo-5hql&pl=20&ratebypass=yes&mime=video/mp4&gir=yes&clen=16938851529&lmt=1498521946448697&dur=36000.000&mt=1502092202&key=dg_yt0&signature=8BDD2573344F5E26CBD46F7EADFDA55BC161A5E5.42FAA9C3F66466197BC24C027F75248F65222A6E&ip=42.106.36.220&ipbits=0&expire=1502113930&sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,mm,initcwndbps,mv,ms,mn,pl,ratebypass,mime,gir,clen,lmt,dur: Server returned 403 Forbidden (access denied)

Thanks, as always, for all the help.

johnhawkinson commented 7 years ago

@rEes9P that seems odd -- did you regenerate the URL by (re)running youtube-dl ... --get-url recently? The URLs it returns are ephemeral -- they last for a few minutes, but not for hours or days.

If regenerating the URL doesn't work, then please include the output of youtube-dl -v along with the rest of your youtube-dl command line (that is, add -v). Or maybe even remove --get-url and include the output -- because if youtube-dl is able to retrieve the URL, ffmpeg should be able to. And if youtube-dl cannot, well, you have a different problem.

johnhawkinson commented 7 years ago

Unfortunately, @siddht4, that is not good advice.

@rEes9P it somehow seems to be related to https://github.com/rg3/youtube-dl#video-url-contains-an-ampersand-and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command .

No it is not. That was the problem in https://github.com/rg3/youtube-dl/issues/622#issuecomment-320600762 but he fixed the curly quotes and that is resolved.

To verify just run youtube-dl -g https://www.youtube.com/watch?v=2QPbriKs_sI -f 22, chances are the cookies and your ip is getting changed.

I'm not sure what you hope to gain from this, but technically it is an error not to quote the URL here. The ? is a shell metacharacter, and if you happen to have a file named https://www.youtube.com/watchXv=2QPbriKs_sI or https://www.youtube.com/watchYv=2QPbriKs_sI in the current directory, bad things will happen.

can you also build your ffmpeg in gcc,just to verify clang is not skipping anything (not likely)

This is so unlikely as to be not worth recommending. Especially for the inexpert, asking them to recompile from source with a different compiler is a huge task and it's not warranted here. There is no evidence of a compiler problem, and such things are extremely rare in cases like this.

Note : there are 4 programs being used here : your shell, youtube-dl, ffmpeg, clang So you should make sure all the 4 are updated.

No. First of all, your shell and compiler (clang) do not need to be updated. Yes, ffmpeg and youtube-dl do change rapidly, so it is wise to keep them reasonably current. Although updates can introduce problems as well. Nothing's perfect.

ffmpeg might not to able to fully understand the url. (likely the issue) . So instead of ffmpeg use wget or any other downloaders to make sure the url returned by youtube-dl is being understood by external programs.

No, this is not likely the issue. But sure, if you've rerun youtube-dl -g and gotten a new URL and it still doesn't work with ffmpeg, try it with wget (but don't wait for it to download the whole thing). This is essentially the same as my earlier suggestion of letting youtube-dl do the download.


I'm sorry for being harsh, but you have given some problematic advice earlier in this thread. Specifically:

Basically you need to provide time in seconds so 20 seconds is 20 and 2 minutes is 120

False. ffmpeg accepts time in hours:minutes:seconds as well as raw seconds, as @JaySandhu noted. See https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax.

You can try https://www.youtube.com/watch?v=2QPbriKs_sI&t=1794 where https://www.youtube.com/watch?v=2QPbriKs_sI is the video andt=1794 is the time from where to begin (29 min 54 sec) for some reason https://www.youtube.com/watch?v=2QPbriKs_sI?start=0&end=1794&version=3 doesnt end at 29 mins 54 sec , but changing start time did changed it start time

I believe this to be wrong. Youtube-dl does not handle starting or ending offsets in Youtube URLs.

Your doesnt work as youtube-dl is not able to get any paramter,so changing it to ffmpeg -ss 0 -i $(youtube-dl -g https://www.youtube.com/watch?v=2QPbriKs_sI -f bestvideo) > -t 1794 -c:v copy -c:a copy output.mp4would work

I'm not sure what this is intended to do, but the > -t would redirect stdout to a file named -t which is certainly not what you want. And then ffmpeg would get confused by the standalone 1794, likely interpreting it as an output file. That's just in error.

This is simply https://www.youtube.com/watch?v=2QPbriKs_sI&start=0&end=1947&version=3 which can be seen in youtube

I'm not sure what you're going for but I think this is a false equivalence.

rEes9P commented 7 years ago

@rEes9P that seems odd -- did you regenerate the URL by (re)running youtube-dl ... --get-url recently? The URLs it returns are ephemeral -- they last for a few minutes, but not for hours or days.

If regenerating the URL doesn't work, then please include the output of youtube-dl -v along with the rest of your youtube-dl command line (that is, add -v). Or maybe even remove --get-url and include the output -- because if youtube-dl is able to retrieve the URL, ffmpeg should be able to. And if youtube-dl cannot, well, you have a different problem.

@johnhawkinson - Thank you! That was it. I ran youtube-dl ... --get-url again and voila! I've learnt a lot because of the generosity and help of the folks here :-)

rEes9P commented 7 years ago

EDIT: This post should largely be disregarded. Please see @johnhawkinson's response in the next post.

Here is a step-by-step guide for those that are new to youtube-dl and/or ffmpeg for downloading a portion of a video. Many thanks to @JaySandhu and @johnhawkinson for all their work. These steps simply collate all the helpful tips they have shared at different places in this thread.

It would be easier to understand these steps with an example and so I am going to use this footage of relaxing sights and sounds of islands from the excellent Planet Earth II. The video loops 30 minutes of footage for 10 hours and so is a good candidate for this task. For this example, we will be extracting the first 29 minutes and 54 seconds of the video.

1. Get the URL of the video using the --get-url command For a specific format youtube-dl -f (desired format) --get-url (youtube link) For the default, highest quality format (the video and audio streams may be different) youtube-dl --get-url (youtube link)

Example For a specific format (-f 22, which is the best version with combined video and audio) youtube-dl -f 22 --get-url "https://www.youtube.com/watch?v=2QPbriKs_sI" For the default, highest quality format (in this case the video and audio are separate). This will result in two separate URLs, but they can easily be combined using ffmpeg as seen below. youtube-dl --get-url "https://www.youtube.com/watch?v=2QPbriKs_sI"

Note that another link (https://www.youtube.com/watch?v=2QPbriKs_sI&list=PLtra-MWzIvZGdqzuA59Jp0dZVzpmNZyT0&index=2) also points to the same video but it is the version that is a part of a playlist (as seen by the string beginning with "&list=..."). We want the version that points to the standalone video and omits the playlist information.

2. Use ffmpeg to get the desired range If the source has both video and audio ffmpeg -ss (start time) -i "link" -t (duration you need) -c:v copy -c:a copy (title.ext) If the source that has separate video and audio streams ffmpeg will combine the two ffmpeg -ss (start time) -i "top link" -i "bottom link" -t (duration you need) -c:v copy -c:a copy (title.ext)

Example For the -f 22 version ffmpeg -ss 00 -i "https://r2---sn-tv0cgv5qc5oq..." -t 00:29:54 -c:v copy -c:a copy Islands.mkv For the highest quality version (different video and audio streams) ffmpeg -ss 00 -i "https://r2---sn-tv0cgv5qc5oq..." -i "https://r2---sn-tv0cgv5qc5oq..." -t 00:29:54 -c:v copy -c:a copy Islands.mkv

Notes

johnhawkinson commented 7 years ago

Several notes:

What @rEes9P is trying to do is handle a particularly annoying case where you need better than 720p quality. That introduces all kinds of extra difficulties, and in most application is not worth it. Using -f 22 gets you 720p quality and that's adequate for almost all cases, and makes this so much simpler.

That is, I would recommend, in modified form from https://github.com/rg3/youtube-dl/issues/622#issuecomment-162337869:

ffmpeg -ss 14350 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 11200 -c copy react-spot.mp4 or (more readable times): ffmpeg -ss 3:59:10 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 3:06:40 -c copy react-spot.mp4


Specific notes:

The video loops 30 minutes of footage for 10 hours and so is a good candidate for this task.

This is actually a terrible candidate for this, because you will not detect a failure of the audio and video to sync up. This is a very serious problem, because indeed the steps you have recommended will give unsynchronized audio, because ffmpeg's input seek parameter applies only to the input source it immediately proceeds. Also, because you chose a start time of zero for your example, you mask this problem as well.

  1. Use ffmpeg to get the desired range If the source has both video and audio ffmpeg -ss (start time) -i "link" -t (duration you need) -c:v copy -c:a copy (title.ext)

This is okay, but ffmpeg provides -c copy which is shorthand for -c:v copy -c:a copy. I'd use it.

If the source that has separate video and audio streams ffmpeg will combine the two ffmpeg -ss (start time) -i "top link" -i "bottom link" -t (duration you need) -c:v copy -c:a copy (title.ext)

Nope. You need to repeat the start time for each input source, so it would need to be:

ffmpeg -ss (start time) -i "top link" -ss (start time) -i "bottom link" -t (duration you need) -c:v copy -c:a copy (title.ext)

Also, you can wrap this thing all together in one command-line if you see fit. For instance:

ffmpeg $(youtube-dl -g 'LINK' | sed "s/.*/-ss STARTTIME -i &/") -t DURATION -c copy FILENAME.mkv

Where the sed command prepends -ss STARTTIME -i to each line of output from youtube-dl -g. For example, I ran:

ffmpeg $(youtube-dl -g 'https://www.youtube.com/watch?v=NnW5EjwtE2U' | sed "s/.*/-ss 10 -i &/") -t 60 -c copy test3.mkv

To get from 00:10 to 01:10 of this week's Last Week Tonight segment.

rEes9P commented 7 years ago

Thank you again @johnhawkinson. Sorry about my earlier post. I meant to be of help to others but I guess I got ahead of myself.

ghost commented 7 years ago

Thanks @johnhawkinson. The sed line you shared, I've found, is essential for use with video editing. Otherwise you have to do additional processing. If you don't, there are syncing issues.

hoangcao10 commented 7 years ago

how it work with vimeo.com

novmikvis commented 6 years ago

@johnhawkinson quick question: what is correct syntax for windows environment? ffmpeg -ss 3:59:10 -i $(youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8') -t 3:06:40 -c copy react-spot.mp4 returns $(youtube-dl: No such file or directory I think it has something to do with "$" and Linux, but I don't have much experience with that

johnhawkinson commented 6 years ago

I don't think Windows CMD.EXE has a direct analog of $() syntax. Use one of the available bash implementations for Windows, or do it by hand:

Run youtube-dl -f 22 -g 'https://www.youtube.com/watch?v=mMZriSvaVP8' and copy the output, which will be the URL (because of -g) of the format 22 version. Then paste it into the ffmpeg command line in place of the $(...) sequence.

akaleeroy commented 6 years ago

@miklide

Windows syntax

for /F "tokens=* delims=" %a in ('youtube-dl --get-url https://oload.stream/embed/Rp8UClDzOKk') do (ffmpeg -ss 00:26:33.091 -i %a -t 9.983 eam.mp4)

(You need phantomjs.exe on PATH to parse the OpenLoad URL in this example)

humanshield89 commented 6 years ago

To get a range you need to send it as a param to the end of the video direct url like this

estathop commented 5 years ago

any progress on this ?

laserroger commented 5 years ago

any progress on this?