How to Block Video Resolutions in mpv?
When streaming video URLs through the mpv media
player, you can automatically block specific resolutions (like 4K or
1080p) to save bandwidth or match your hardware capabilities by
configuring the --ytdl-format option. This setting allows
you to intercept the stream request and filter out formats that exceed
your desired height or width before the playback begins. By mastering a
few simple command-line arguments or updating your local configuration
file, you can completely customize your streaming quality limits.
Understanding the
--ytdl-format Flag
Because mpv relies on yt-dlp (or
youtube-dl) to process network stream URLs, it inherits its
powerful video selection syntax. By default, mpv requests the absolute
best quality available. However, you can pass custom rules to instruct
it to select the best quality only up to a certain
threshold.
Command-Line Examples
If you want to enforce these rules on a case-by-case basis, you can pass the format string directly into your terminal or command prompt.
- Block anything above 1080p (Caps stream at 1080p):
mpv --ytdl-format="bestvideo[height<=1080]+bestaudio/best" "YOUR_URL_HERE" - Block anything above 720p (Great for saving data):
mpv --ytdl-format="bestvideo[height<=720]+bestaudio/best" "YOUR_URL_HERE" - Block specific exact resolutions (e.g., skip exactly 4K but
allow others):
mpv --ytdl-format="bestvideo[height!=2160]+bestaudio/best" "YOUR_URL_HERE"
Making the Resolution Block Permanent
Instead of typing the format rule every time you stream a link, you can save it directly to your mpv configuration file. This ensures that any URL dropped into mpv will automatically adhere to your resolution limits.
- Locate your
mpv.conffile:
- Linux/macOS:
~/.config/mpv/mpv.conf - Windows:
%APPDATA%\mpv\mpv.conf(or inside the same folder as yourmpv.exe)
- Open the file in a text editor.
- Add the following line to block video resolutions higher than 1080p:
ytdl-format="bestvideo[height<=1080]+bestaudio/best"
Advanced Filtering Options
If your network connection fluctuates, you can add fallback conditions to your configuration. The table below outlines common syntax structures for advanced resolution blocking:
| Goal | Syntax Rule to Use |
|---|---|
| Strictly under 60fps | bestvideo[height<=1080][fps<=30]+bestaudio |
| Fallback if no audio match | bestvideo[height<=1080]+bestaudio/best[height<=1080] |
| Target a specific width | bestvideo[width<=1920]+bestaudio/best |
Note: If a streamed video does not offer a resolution lower than your cap, mpv will typically fallback to the closest available quality or throw an error if a strict fallback rule isn’t specified. Using the
/bestsyntax at the end of your string ensures that the player always plays something rather than crashing.