Prerequisites:
Get available formats for the youtube video:
[mumrik@snusmumriken ~]$ youtube-dl -F https://www.youtube.com/watch?v=BvId5-0295U
[youtube] BvId5-0295U: Downloading webpage
[youtube] BvId5-0295U: Downloading video info webpage
[youtube] BvId5-0295U: Extracting video information
[youtube] BvId5-0295U: Downloading MPD manifest
[info] Available formats for BvId5-0295U:
format code extension resolution note
140 m4a audio only DASH audio 137k , m4a_dash container, mp4a.40.2@128k (44100Hz), 162.65MiB
160 mp4 256x144 DASH video 126k , avc1.4d400c, 30fps, video only, 127.46MiB
133 mp4 426x240 DASH video 275k , avc1.4d4015, 30fps, video only, 281.09MiB
134 mp4 640x360 DASH video 342k , avc1.4d401e, 30fps, video only, 257.88MiB
135 mp4 854x480 DASH video 690k , avc1.4d401f, 30fps, video only, 538.66MiB
136 mp4 1280x720 DASH video 1392k , avc1.4d401f, 30fps, video only, 1.05GiB
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)
-F: show available formats for the youtube video.
Get the URL for the youtube video format you want:
[mumrik@snusmumriken ~]$ youtube-dl -g -f 22 https://www.youtube.com/watch?v=BvId5-0295U
https://r3---sn-hvcpauxa-nv4s.googlevideo.com/videoplayback?mime=video%2Fmp4&upn=VERY_VERY_LONG_STRING_HERE!
-f: the format of the video, the number in the first column in the output of thе previous command.
-g: do not download but just output video’s URL.
Copy the URL exactly and entierly!
Now record that part of the video you want using ffmpeg:
[mumrik@snusmumriken ~]$ ffmpeg -i 'PASTE_HERE_URL_FOR_THE_VIDEO' -ss 1:10:05 -t 00:07:35 -c copy part.mp4
-ss: start point form where your recording will begin
-t: duration of the part you want to record