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.

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.

  1. Locate your mpv.conf file:
  1. Open the file in a text editor.
  2. 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 /best syntax at the end of your string ensures that the player always plays something rather than crashing.