4 ms·
> Because of my network limitation If I'm understanding correctly your snippet you're downloading the whole video anyway, no?
by jmnicolas 5y ago
> Because of my network limitation
If I'm understanding correctly your snippet you're downloading the whole video anyway, no?
- mdp2021 5y agoI also see that, that syntax should not just download a slice: -f is for the format and -g should be simulation (-g for --get-url : 'Simulate, quiet but print title'). Probably an "undocumented" behaviour of '-g'?
- mdp2021 5y agoMy former comment (uneditable) was not really getting the mechanism: -g does get the URL, as the expanded option name says (though the explanation says something different), and `ffmpeg -i URL` accepts as input the googlevideo.com URLs. Ok. Also, the costruct seems to accept input, at least sometimes, from e.g. '-f 137' (mp4 1080), so "very Hi-Res", and '-f 140' (m4a 128kbit), which can be then recombined. So, downloads higher than "720 rasterbars" are in general possible - and they are probably frequent real cases, when one needs to obtain a few frames of very high quality video. The thing is, it seems to download the initial part anyway. The command takes a lot of time to download, and using e.g. 'iftop' one can see that the command starts downloading immediately, e.g. maybe ~5MB with a '-ss 00:00:10', and ~10MB with a '-ss 00:00:20': the use of '-tt range_end' or '-t duration' will stop downloading at the correct point, but the construct does not really "seek" to the starting point of the video. Maybe adding some parameter to the URL?
- thrdbndndn 5y ago-g is "Simulate, quiet but print URL", not "print title" which is "-e". Simulate here means it does not download the video. You pass the URL to the ffmpeg which actually downloads the video.
- mdp2021 5y agoMy bad! Inattention while copying. Yes, clearly (after possible initial confusion) -g provides the URL from ffmpeg, which is the actual downloader. The issue then is is moved to the "seek" operation, which is not done by either command (the URL does not contain positioning (for the start of range), and ffmpeg downloads from the beginning of the video - undesirable - up to the specified limit - wanted).
- NavinF 5y agoI assume ffmpeg is seeking ahead with the http Range header
- montebicyclelo 5y agoIt looks kinda like that, but no. ‘youtube-dl -f best -g …’ returns a url, and ffmpeg seeks in the video stream and doesn’t download the whole thing.
- jmnicolas 5y agoWow nice! Thanks for the explanation, else I would have dismissed this beautiful hack!