pretty often these days, if you grab the "highest quality" available youtube video, it is actually kept in two separate URIs. So ffmpeg chokes on trying to get a segment a la
ffmpeg -ss 15
-i $(yt-dlp -g VIDEOIDHERE)
-t 5 just_a_clip.mp4
yt-dlp itself will mux the sources and spit out a .webm, even if you indicated .mp4 as your output extension. You can force it to re-encode and apparently yt-dlp can do its own segment clipping now, so the equivalent of the above would be
yt-dlp VIDEOIDHERE
--download-sections "*15-20"
--force-keyframes-at-cuts
--recode mp4 -o just_a_clip.mp4
but when I run that it takes 23.238seconds to finish. Which is insane. The much more disgusting ffmpeg command below will do it in 6.327 seconds (using pwsh here):
$ytdluris = $(yt-dlp -g VIDEOIDHERE);
ffmpeg -ss 15 -i $ytdluris[0]
-ss 15 -i $ytdluris[1]
-map 0:0 -map 1:0
-c:v libx264 -c:a aac
-t 5 .\just_a_clip.mp4
the lesson, as always: esoteric and physically revolting command line garbage will always be more performant than sane and legible arguments, for some reason.

