How to download a desired clip from a long online YouTube video

MarkG_108

New Member
Hello. Recently there was a four minute clip, from a three hour documentary, that I wanted to download (the documentary was online at YouTube). I did not wish to take the time (and bandwidth) to download the entire documentary. So, I researched and discovered there is a way, via both youtube-dl and ffmpeg, to simply download a specific clip from a long video.

First, the proper URL of the video must be determined. That is accomplished with youtube-dl. Here are the steps (note, in real life, the asterisks would be replaced with the actual youtube URL):
1.) get the options for full videos (to avoid getting a "video only" or "audio only" file)
Code:
youtube-dl --F https://www.youtube.com/watch?v=**********
There will be a list of numbered options. Generally I default to what YouTube labels as the "best". Let's say that "18" was the best full video with audio option given. So, having determined what I'd like to download, I now need to get the proper URL for the download. That is accomplished via the following command:
Code:
youtube-dl -f 18 --get-url https://www.youtube.com/watch?v=**********
Note that "18" is only being used as an example -- it likely will be different in an actual circumstance. Anyway, the actual URL given from this command will be rather large (perhaps 850 characters or so). Don't be intimidated. Just select and copy the URL.

Now, let's say that you want to download a four minute clip from a three hour (180 minutes) video file that is on YouTube. And let's say that this four minute clip is from the sixty minute mark of the video. Thus, the command would be as follows:
Code:
ffmpeg -ss 01:00:00.00 -t 00:04:00.00 -i "{the long URL}" -c copy "{output_file.mp4}"
Note above that "{output_file.mp4}" is simply the name you would give the resultant file (best to stick with the file extension "mp4").
-ss is slow start and defines where ffmpeg should start in the video, and this has to be in HH:MM:SS.MS format (in the example above, it starts at the one hour mark of the video).
-t is the duration time of the amount of video you want to capture (four minutes in the example above).
-i is an input file (in this case, the long youtube URL).
 
Last edited:


Members online



Top