Downloading a Youtube video with youtube-dl is pretty common, but it is also possible to feed it directly into FFmpeg using parameter expansion in bash.
┌─[jason@jason-desktop]─[~/Videos] └──╼ $ffmpeg -i $(youtube-dl -f 22 -g https://www.youtube.com/watch?v=laJpHzVtF9k) output.ts |
This command will get a Youtube video file and then process it with FFmpeg.
This version will save a copy of the video in black and white.
┌─[jason@jason-desktop]─[~/Videos] └──╼ $ffmpeg -i $(youtube-dl -f 22 -g https://www.youtube.com/watch?v=laJpHzVtF9k) -vf hue=s=0 -c:a copy output.ts |
But this really does work well when working with Youtube videos.
List all video formats like this.
┌─[✗]─[jason@jason-desktop]─[~/Videos] └──╼ $youtube-dl -F https://www.youtube.com/watch?v=laJpHzVtF9k [youtube] laJpHzVtF9k: Downloading webpage [info] Available formats for laJpHzVtF9k: format code extension resolution note 249 webm audio only tiny 53k , opus @ 50k (48000Hz), 4.03MiB 250 webm audio only tiny 69k , opus @ 70k (48000Hz), 4.86MiB 140 m4a audio only tiny 130k , m4a_dash container, mp4a.40.2@128k (44100Hz), 10.69MiB 251 webm audio only tiny 135k , opus @160k (48000Hz), 9.41MiB 394 mp4 256x144 144p 80k , av01.0.00M.08, 24fps, video only, 5.49MiB 278 webm 256x144 144p 88k , webm container, vp9, 24fps, video only, 6.56MiB 160 mp4 256x144 144p 110k , avc1.4d400c, 24fps, video only, 4.61MiB 395 mp4 426x240 240p 174k , av01.0.00M.08, 24fps, video only, 10.26MiB 242 webm 426x240 240p 192k , vp9, 24fps, video only, 10.99MiB 133 mp4 426x240 240p 244k , avc1.4d4015, 24fps, video only, 9.47MiB 396 mp4 640x360 360p 385k , av01.0.01M.08, 24fps, video only, 19.92MiB 243 webm 640x360 360p 412k , vp9, 24fps, video only, 21.80MiB 134 mp4 640x360 360p 601k , avc1.4d401e, 24fps, video only, 17.97MiB 397 mp4 854x480 480p 694k , av01.0.04M.08, 24fps, video only, 34.81MiB 244 webm 854x480 480p 757k , vp9, 24fps, video only, 35.66MiB 135 mp4 854x480 480p 904k , avc1.4d401e, 24fps, video only, 31.50MiB 398 mp4 1280x720 720p 1361k , av01.0.05M.08, 24fps, video only, 63.89MiB 247 webm 1280x720 720p 1514k , vp9, 24fps, video only, 62.04MiB 136 mp4 1280x720 720p 2314k , avc1.4d401f, 24fps, video only, 75.94MiB 18 mp4 640x360 360p 512k , avc1.42001E, 24fps, mp4a.40.2@ 96k (44100Hz), 42.31MiB 22 mp4 1280x720 720p 1049k , avc1.64001F, 24fps, mp4a.40.2@192k (44100Hz) (best) |
Then, use the -f parameter to youtube-dl to set the appropriate video format. This is very simple and fun once you get it to work, but the command is very finicky. I am just glad I got it to work properly for once.