mpv, ffmpeg and yt-dl - The Ultimate Team

Dec. 8, 2022 [technology] [guides] [libre]

mpv, ffmpeg and youtube-dl/yt-dlp. With this trifecta, almost any media can be accessible to view in any way you want. To download, manipulate and view anywhere, any time. It grants you complete control and totally outclasses the more widely known VLC. Some capabilities I have already covered in command line video/audio editing guides. * Note: I use yt-dl to refer to both youtube-dl and yt-dlp interchangeably, courtesy of the endless forking found in high profile projects.

The hunt

Some of the programs make calls to one another, such as with mpv’s yt-dl calls. Either through –ytdl-raw-options, –ytdl-format=, and/or prefixing ytdl:// to a target download address. For example, playing back only the best quality version of a video file from ThemTube:

mpv --ytdl-format=best

yt-dl, in turn, can pass off to ffmpeg. In fact, many things yt-dl does behind the scenes uses ffmpeg (or avconv depending on which is present and which is best suited). But you can manually call ffmpeg functions with –postprocessor-args. The following would download only the video portion between 00:03 seconds and 01:03 minutes:

youtube-dl --postprocessor-args "-ss 00:00:03 -t 00:01:00"

Or if you would like to capture all videos posted from a certain channel within the last three weeks:

yt-dlp --extractor-args youtubetab:approximate_date --break-on-reject --dateafter now-3weeks -o "/path/to/storage/%(title)s.%(ext)s"

If a particular video is region locked or IP blocked, we can further mix in other programs (Using format selection for the lowest quality in respect of Tor network capacity):

torsocks yt-dlp -f 18

mpv is its own beast. Some common shortcuts you might find useful include:

Shortcut Function
9 / 0 Decrease/increase volume
Shift + # Enable/disable audio
Shift + J Cycle subtitles
[ / ] Decrease/increase playback speed
Shift + L Loop file
i / I Display video file information

Start or end playback at a specific timestamp:

mpv --start=00:00:50

Remember, content tyrants do not want you saving content locally for a reason. They would much prefer everyone be cattlechuted into DRM encumbered proprietary web stream players or mobile applications with restrictions on when, where, on what and by whom any piece of media can be accessed. It would be awful for them if you were to save and share any of it on massive external drives.

This tag team of software is pretty much unrivaled. Although VLC has Santa hats …I guess.