- Test mpv without configuration before editing profiles, scripts, or hardware decoding.
- Use yt-dlp format listings to verify available resolutions, codecs, video, and audio.
- Build reliable ytdl-format rules with resolution limits and sensible fallbacks.
- Confirm the Symptom With a Minimal Clean mpv Command
- Inspect the Online Format Selection Rule
- Find Conflicting Configurations, Profiles, Bindings, and Scripts
- Verify yt-dlp, Paths, Quoting, Network Access, and System Support
- Use Logs, Profiles, Stats, and Track Information
- Run a Clean Temporary Test Before Permanent Changes
- Quick Fix Checklist
- Frequently Asked Questions
When mpv chooses the wrong YouTube resolution, codec, or audio and video combination, the problem is usually not mpv's local-file decoder. Online playback adds another selection layer: mpv asks yt-dlp to inspect the URL, yt-dlp reports the available formats, and mpv opens the selected streams. A restrictive ytdl-format rule, outdated yt-dlp executable, conflicting profile, shell-quoting mistake, unavailable format, or hardware-decoding limitation can disrupt that process.
This guide focuses specifically on online format selection. Start with a clean command, inspect what YouTube currently offers, and change one setting at a time. Once the clean test produces the intended resolution with working audio and smooth playback, stop changing unrelated subtitle, screenshot, output, or local-file options.

Start with free Canva bundles
Browse the freebies page to claim ready-to-use Canva bundles, then get 25% off your first premium bundle after you sign up.
Free to claim. Canva-ready. Instant access.
1. Confirm the Symptom With a Minimal Clean mpv Command
Before editing mpv.conf, determine whether the failure comes from your configuration or the online extraction path. Open a terminal and run mpv without loading normal configuration files, scripts, profiles, or user input bindings:
mpv --no-config "https://www.youtube.com/watch?v=VIDEO_ID"Replace the example address with the exact URL that shows the problem. Quoting the URL is important because playlist parameters and other query-string characters can be interpreted by a shell.
On PowerShell or a Unix-like shell, single quotes are also suitable:
mpv --no-config 'https://www.youtube.com/watch?v=VIDEO_ID'Watch the terminal output and the video itself. If the clean command selects an appropriate format, produces audio, and plays smoothly, mpv and yt-dlp can handle the URL. The likely cause is then an option, profile, script, or binding in your regular setup.
If the clean command still selects an unexpected resolution or fails to open the URL, test the desired format explicitly:
mpv --no-config --ytdl-format="bestvideo[height<=1080]+bestaudio/best[height<=1080]" "URL"This expression first requests separate video and audio streams with a maximum video height of 1080 pixels. The slash provides a fallback to a combined format when separate streams cannot be used. Success means the terminal identifies separate audio and video streams, the displayed video is no higher than 1080p, and audio is present.
Do not assume that a label such as 1080p identifies a single universal format. YouTube can offer the same resolution using AV1, VP9, H.264, or other combinations, and availability can vary by video. A rule that worked for one upload may match nothing on another.
2. Inspect the Online Format Selection Rule
2.1 Understand the ytdl-format option
mpv's ytdl-format option supplies a format-selection expression to its supported URL extractor, normally yt-dlp. On the command line, use the leading double hyphen:
mpv --ytdl-format="bestvideo+bestaudio/best" "URL"Inside mpv.conf, omit the leading hyphens:
ytdl-format=bestvideo+bestaudio/bestThe expression has two important operators:
+requests multiple streams, such as the best video-only stream plus the best audio-only stream./defines a fallback if the expression on its left is unavailable.
Therefore, bestvideo+bestaudio/best means to prefer the best separate video and audio streams, then fall back to the best combined stream. It does not guarantee a particular codec, frame rate, dynamic range, or resolution.
If unrestricted selection causes buffering or excessive decoding load, apply a practical resolution cap:
ytdl-format=bestvideo[height<=1440]+bestaudio/best[height<=1440]If this produces the selected maximum resolution, audible sound, and stable playback, the format rule is working. Do not add codec filters unless you have identified a specific compatibility or performance problem.
2.2 Test current availability with yt-dlp -F
Use yt-dlp directly to see the formats currently advertised for the video:
yt-dlp -F "URL"On systems where the executable has another name or is not on PATH, invoke its full trusted path. The output normally lists format identifiers and details such as resolution, frame rate, container, video codec, audio codec, and whether a row contains video only or audio only.
Look for the following details:
- Whether the requested resolution actually exists
- Whether the desired row is video-only and therefore needs a separate audio stream
- Which codecs are offered at the target resolution
- Whether the listed formats changed since you created a numeric format-ID rule
- Whether yt-dlp reports extraction, authentication, network, or availability errors
A hard-coded rule such as ytdl-format=137+140 is fragile because those identifiers may be absent from a particular video. Prefer capability-based expressions unless you have a controlled reason to request exact IDs.
Success means yt-dlp -F completes without an extraction error and shows formats that your expression can match. If the desired format is not listed, mpv cannot select it. Stop modifying mpv and choose an available format instead.
2.3 Account for AV1, VP9, and HEVC performance
Higher-ranked formats are not automatically easier for a computer to play. AV1 can deliver strong compression efficiency, but software decoding may be demanding on older CPUs. VP9 is widely used for higher-resolution YouTube video, yet hardware support varies by GPU generation and operating-system video stack. HEVC playback also depends on the source, operating system, build capabilities, and hardware path.
If mpv selects the requested resolution but playback drops frames, stutters, or consumes unusually high CPU, format selection may already be correct. The remaining issue is decoder performance. First test hardware decoding without making it permanent:
mpv --no-config --hwdec=auto-safe --ytdl-format="bestvideo[height<=1080]+bestaudio/best[height<=1080]" "URL"If that is not smooth, compare it with software decoding:
mpv --no-config --hwdec=no --ytdl-format="bestvideo[height<=1080]+bestaudio/best[height<=1080]" "URL"You can also test a lower resolution before forcing a codec:
mpv --no-config --ytdl-format="bestvideo[height<=720]+bestaudio/best[height<=720]" "URL"Success is smooth playback with low or acceptable dropped-frame counts, correct audio, and the intended resolution. Once one decoder mode works consistently, stop adjusting unrelated output or audio options.
3. Find Conflicting Configurations, Profiles, Bindings, and Scripts
3.1 Compare mpv.conf with the clean test
If --no-config works but normal playback does not, inspect your active mpv.conf. Search for every occurrence of these options:
ytdlorytdl-formatprofileand profile sectionsvid,aid,video, oraudiohwdec,vo, and GPU-related settingsscript,script-opts, or script-specific quality settingslavfi-complexor track-selection filters
Comment out only the suspected line by placing # at its beginning, then retest. Do not delete the entire configuration directory. A targeted comparison preserves custom subtitles, shaders, HDR handling, screenshots, IPC, and local-file behavior while identifying the actual conflict.
Subtitle settings and screenshot templates do not normally determine YouTube format selection. However, a malformed option, script error, or profile that changes track selection can make the overall player behavior appear broken. Investigate those features only if the log shows a related error or the clean test proves that configuration loading triggers the symptom.
3.2 Check input.conf and quality-selection scripts
Some mpv setups use an input.conf binding or third-party script to cycle formats, reopen URLs, set tracks, or apply profiles. A key may run a command that overrides your initial selection after playback starts.
Search input.conf and script configuration files for terms such as ytdl-format, loadfile, apply-profile, aid, and vid. Temporarily disable only the relevant binding or script and repeat the same URL test.
Success means the chosen format remains stable after startup and after pressing your normal playback keys. If disabling one quality-selection script fixes the issue, update or reconfigure that script rather than compensating with more global mpv options.
3.3 Create a controlled online-video profile
A dedicated profile keeps online preferences separate from local high-bitrate files, HDR media, shaders, and network streams. Add a manually invoked profile to mpv.conf:
[online-video]
ytdl-format=bestvideo[height<=1080]+bestaudio/best[height<=1080]
hwdec=auto-safeTest it with:
mpv --profile=online-video "URL"Inspect the profile without playing anything by running:
mpv --show-profile=online-videoThis displays the options assigned to the profile and helps expose a misspelled or unexpectedly inherited setting. Keep the profile manual until it works reliably. Automatic conditional profiles can be useful, but they add another condition to troubleshoot.
Success means the profile applies only when requested, selects a suitable online format, and leaves local-file playback unchanged.

4. Verify yt-dlp, Paths, Quoting, Network Access, and System Support
4.1 Confirm that mpv can find yt-dlp
A working yt-dlp -F command does not always prove that a graphical launcher or separately installed mpv process sees the same executable. Terminal and desktop applications can inherit different PATH values, especially on Windows and macOS.
Run mpv from the same terminal where yt-dlp works. If that succeeds but launching mpv from a file manager does not, the problem is likely executable discovery or environment configuration. Use the official yt-dlp installation guidance and your mpv build provider's documented integration method. Avoid random repackaged binaries and codec bundles.
When specifying an external executable path through an mpv option supported by your setup, quote paths containing spaces and verify the path points to the actual executable. A typo can cause mpv to report that the extractor failed or was not found.
Success means mpv's terminal output shows that the URL was recognized and processed through the online extraction path, rather than treated as a direct media file that cannot be opened.
4.2 Check shell quoting and URL integrity
URLs containing &, question marks, playlist parameters, or shell-special characters should be quoted. Without quotes, a shell may truncate the URL or treat part of it as another command.
Test the exact watch URL before testing a playlist URL. If a playlist opens the wrong entry or applies unexpected behavior, remove playlist parameters and confirm one video first. Then restore the playlist URL after single-video selection works.
Also ensure that a copied URL has not been altered by smart quotes, line wrapping, or an application that escapes ampersands as HTML. Success means both yt-dlp and mpv receive the complete URL and identify the expected video.
4.3 Separate network and availability failures from selection failures
If yt-dlp -F cannot list formats, format rules are not yet the issue. Check whether the video is unavailable, private, region-restricted, age-restricted, live, or temporarily inaccessible. Authentication-dependent content may require legitimate account access handled according to yt-dlp's official documentation and the service's terms.
Proxies, DNS filters, firewalls, antivirus inspection, captive portals, and restricted networks can also interrupt extraction or stream access. Compare another public YouTube URL and another network only when permitted. Do not attempt to bypass DRM or access controls.
Success means format enumeration works and the selected media URLs remain reachable long enough for playback. If all URLs fail before formats are listed, resolve the network or extractor problem before editing codec preferences.
4.4 Treat GPU and display errors as playback-stage problems
If the terminal confirms the requested streams but the video window is black, corrupted, or unstable, selection has probably succeeded. Now compare --hwdec=no with --hwdec=auto-safe. On Linux, display-server and driver differences can affect Wayland, X11, VA-API, Vulkan, or OpenGL paths. On Windows and macOS, driver and operating-system support similarly influence hardware decoding.
Do not change the audio backend, screenshot directory, subtitle renderer, or output driver merely because the displayed resolution is wrong. Change those only when the log identifies a corresponding output, permission, or initialization failure.
5. Use Logs, Profiles, Stats, and Track Information
5.1 Capture useful terminal output
Run a failing URL with focused diagnostic output:
mpv --msg-level=ytdl=trace "URL"For a persistent record, add a log file:
mpv --log-file=mpv-youtube.log --msg-level=ytdl=trace "URL"Use a writable path if the current directory is protected. The log can reveal whether mpv found yt-dlp, which format expression it requested, whether the extractor returned formats, and whether opening the selected streams failed.
Logs may contain URLs or environment details. Review and redact sensitive information before sharing them publicly.
5.2 Compare loaded profile options
Use --show-profile for any named profile that may alter online playback:
mpv --show-profile=online-videoThen compare normal playback with these two runs:
mpv --no-config "URL"
mpv --profile=online-video "URL"If only the profiled run fails, the cause is inside that profile or another option it activates. If both fail identically, focus on yt-dlp, format availability, network access, and decoder support.
5.3 Inspect stats and active tracks
Use mpv's built-in stats overlay during playback, commonly toggled with i in default configurations. It can help you inspect displayed dimensions, frame rate, dropped frames, codecs, and decoding behavior. Custom input bindings may replace the default key, so check your active bindings if nothing appears.
Also inspect the audio and video tracks through mpv's track controls or console. A bestvideo+bestaudio selection should normally produce an active video track and an active audio track. If video is correct but silent, verify that an audio stream was selected and that a custom aid setting or script did not disable it.
Success means the active track information agrees with the intended resolution and codec, while dropped frames remain acceptable. At that point, format selection is fixed even if you later choose to tune buffering or rendering performance.
6. Run a Clean Temporary Test Before Permanent Changes
Use a short test sequence that isolates one layer at a time:
- Run
yt-dlp -F "URL"and confirm the target resolution and codecs exist. - Run
mpv --no-config "URL"to establish the default behavior. - Add only the intended
--ytdl-formatexpression. - Compare
--hwdec=noand--hwdec=auto-safeif playback performance is poor. - Run normal mpv and compare its behavior with the clean result.
- Re-enable one profile, script, or binding at a time until the conflict appears.
Keep the URL, network, and test point in the video constant. Testing different videos while changing several options makes it difficult to distinguish an unavailable format from a configuration regression.
A successful clean test has four characteristics: yt-dlp lists formats, mpv selects a matching video and audio combination, the stats or track information confirms the expected properties, and playback is stable enough for the computer. Once all four are true, copy only the proven options into a dedicated profile.
7. Quick Fix Checklist
- Quote the complete YouTube URL in the terminal.
- Confirm the issue with
mpv --no-config "URL". - Run
yt-dlp -F "URL"to verify current format availability. - Replace brittle numeric IDs with
bestvideo+bestaudio/bestor a height-limited expression. - Use
ytdl-format=...inmpv.conf, without command-line hyphens. - Check whether mpv and yt-dlp are visible in the same environment.
- Inspect profiles with
mpv --show-profile=PROFILE_NAME. - Temporarily disable only relevant quality scripts or input bindings.
- Compare
hwdec=noandhwdec=auto-safewhen the right format stutters. - Capture
ytdl=traceoutput when extraction or selection remains unclear. - Stop changing settings when the selected tracks, resolution, audio, and playback are correct.
8. Frequently Asked Questions
8.1 Why does mpv choose 720p when 1080p exists?
The 1080p option may be video-only, while a combined 720p stream includes both audio and video. A rule requesting only a single combined format can therefore settle on 720p. Try bestvideo[height<=1080]+bestaudio/best[height<=1080], then confirm with the active track list and stats overlay.
8.2 Why does bestvideo+bestaudio produce no sound?
The audio stream may have failed to open, a custom aid option may have disabled it, or a script may have changed tracks. Check the terminal and track list. Include the fallback /best, and test under --no-config to rule out track-selection settings.
8.3 Can I force AV1, VP9, or H.264?
yt-dlp format filters can express codec preferences, but forcing a codec reduces the number of matching formats and can break on videos that do not offer it. First establish that unrestricted or height-limited selection works. Force a codec only after yt-dlp -F confirms availability and you have measured a real decoding or compatibility benefit.
8.4 Why did a format rule suddenly stop working?
YouTube's available formats can vary by upload and can change over time. Exact numeric format IDs and narrow codec filters are particularly fragile. Run yt-dlp -F again, update yt-dlp through an official method when extraction itself fails, and prefer capability-based expressions with a fallback.
8.5 Does mpv need FFmpeg to merge bestvideo and bestaudio?
For mpv playback, separate selected streams can be opened as audio and video tracks without first creating a permanently merged output file. yt-dlp's separate download and post-processing workflows have their own FFmpeg requirements. Do not install an untrusted codec pack to solve mpv URL playback.
8.6 What is the safest permanent configuration?
Use a small, manually selected online-video profile containing only the tested resolution rule and, if beneficial, a proven hardware-decoding option. Keep local-file shaders, HDR settings, subtitle preferences, screenshots, and experimental scripts outside that profile unless they are deliberately needed for online playback.