- Test browser cookies directly with yt-dlp before changing mpv settings.
- Pass verified cookies through mpv using ytdl-raw-options.
- Fix stale cookies, quoted paths, permissions, and frontend environment differences.
- Confirm the Symptom With a Minimal Clean mpv Command
- Pass Cookies Through ytdl-raw-options Correctly
- Check Cookie Source, Freshness, Paths, and Permissions
- Verify the yt-dlp Executable and Frontend Environment
- Use Logs and Profiles to Find Overridden Settings
- Run a Clean Temporary Test Before Editing More Options
- Quick Fix Checklist
- Frequently Asked Questions
When mpv can open ordinary videos but fails on an online URL that requires authentication, age verification, consent, or an active browser session, the problem is often that yt-dlp is not receiving usable cookies. The usual causes are an incorrect ytdl-raw-options setting, the wrong browser or browser profile, shell quoting mistakes, an expired cookie file, an inaccessible yt-dlp executable, or a frontend that launches mpv in a different environment. The safest approach is to test yt-dlp independently, reproduce the problem with a clean mpv command, and change only the layer that fails.

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
Start by separating a cookie problem from an unrelated mpv player issue. Subtitle selection, HDR output, shaders, hardware decoding, audio devices, screenshots, and custom scripts normally do not determine whether yt-dlp can authenticate to a website. A clean test prevents those settings from obscuring the real error.
1.1 Run mpv without your normal configuration
Close mpv and launch it from a terminal with a URL you are authorized to access. Replace the example URL with the actual page:
mpv --no-config --log-file=mpv-cookie-test.log --msg-level=ytdl_hook=debug "https://example.com/video"
On Windows, use Command Prompt or PowerShell and keep the URL inside quotes. On Linux or macOS, use a terminal and quote the URL so characters such as &, ?, and # are not interpreted by the shell.
This test establishes a baseline. If the page plays without cookies, authentication was not required for that particular URL. If the log mentions sign-in requirements, unavailable formats, bot verification, or an extractor error, continue with a direct yt-dlp test. If mpv cannot find yt-dlp, solve the executable path problem before changing cookie settings.
1.2 Test yt-dlp before testing mpv
Run yt-dlp directly in the same terminal and user account used to launch mpv:
yt-dlp --verbose --cookies-from-browser firefox "https://example.com/video"
Replace firefox with the browser containing the authenticated session, such as chrome, chromium, edge, brave, opera, safari, or vivaldi, where supported by your yt-dlp installation and operating system. Browser support and cookie-store access vary, so rely on the output from the installed yt-dlp rather than assuming every browser works identically everywhere.
If you do not want to download the media during diagnosis, request metadata or simulate processing:
yt-dlp --verbose --simulate --cookies-from-browser firefox "https://example.com/video"
Success means yt-dlp recognizes the site, reads the browser cookies, and reaches the requested page without an authentication error. Once this succeeds, stop changing browser settings. Move to passing the same working option through mpv.
If the direct command fails, mpv cannot repair it. Resolve the browser profile, permissions, cookie freshness, network, or yt-dlp issue first.
2. Pass Cookies Through ytdl-raw-options Correctly
mpv delegates supported online URLs to its yt-dlp integration. Options intended for yt-dlp can be supplied through mpv's ytdl-raw-options setting. The important detail is that mpv must receive the complete raw option without the shell or configuration parser altering it.
2.1 Use cookies from a browser
After the direct yt-dlp browser test succeeds, try the equivalent clean mpv command:
mpv --no-config --ytdl-raw-options=cookies-from-browser=firefox --msg-level=ytdl_hook=debug "https://example.com/video"
Use the browser value that worked in the direct test. If the browser has multiple profiles, yt-dlp may need a browser-specific profile selector. Establish the exact selector with yt-dlp first, then pass the same value through mpv. Because profile syntax can contain punctuation or spaces, quoting requirements depend on the shell.
Success looks like mpv resolving the page, selecting a playable format, and beginning playback without repeating the prior sign-in or cookie error. At that point, stop modifying unrelated playback options. Your video output, hardware decoder, HDR, subtitle, audio-track, and screenshot settings did not cause the authentication failure.
2.2 Add the working setting to mpv.conf
Once the clean command works, add the setting to the mpv configuration file:
ytdl-raw-options=cookies-from-browser=firefox
Do not include the command-line prefix -- in mpv.conf. Also check whether another occurrence of ytdl-raw-options appears later in the file, inside an automatically activated profile, or in a frontend's launch arguments. A later assignment can replace the one you intended to use.
Test mpv again through the same launch method you normally use. If terminal playback works but a graphical frontend fails, the configuration may not be the problem. The frontend may use a different mpv executable, configuration directory, yt-dlp path, working directory, or user environment.
2.3 Use a cookies file when browser extraction is unsuitable
If browser-cookie extraction is unavailable or unreliable in your environment, yt-dlp can read a Netscape-format cookies file. First verify the file directly:
yt-dlp --verbose --simulate --cookies "/absolute/path/to/cookies.txt" "https://example.com/video"
Then test it through mpv:
mpv --no-config --ytdl-raw-options=cookies="/absolute/path/to/cookies.txt" "https://example.com/video"
Shell handling differs across Windows, Linux, and macOS. If the path contains spaces, commas, quotation marks, backslashes, or other special characters, begin with a temporary cookies file in a simple absolute path. For example, use a path without spaces during diagnosis. This distinguishes bad cookie data from a quoting problem.
Treat a cookies file like a password because it can contain active session credentials. Store it in a private location, restrict access where your operating system supports permissions, never upload it to a public issue report, and do not commit it to a repository.
3. Check Cookie Source, Freshness, Paths, and Permissions
A syntactically correct option can still fail when the cookie source is wrong or inaccessible. Work through these checks only if the direct yt-dlp test does not succeed.
3.1 Confirm the correct browser and profile
Open the target website in the selected browser profile and confirm that the account is signed in. Multiple profiles are a common source of confusion. A default browser profile may have no authenticated session while a work, personal, or secondary profile contains the required cookies.
Do not assume that being signed in to a browser means the relevant profile is available to the process running yt-dlp. A sandboxed application, containerized package, remote session, service account, or differently privileged process may see another home directory or lack access to the browser's cookie database.
Success means the direct yt-dlp command explicitly reads cookies from the intended profile and accesses the page. Once that happens, do not export new cookies or alter profile settings unless the session later expires.
3.2 Refresh stale cookies
Cookies may expire, be rotated after a password change, or become invalid when a website ends a session. Sign out and back in through the browser only if normal browser access itself appears stale. Then repeat the direct yt-dlp simulation.
If you use a cookies file, create a fresh export using a method you trust and confirm that it is in the Netscape cookie-file format expected by yt-dlp. A file can exist and still be unusable because it is empty, exported in another format, missing the required domain, or populated with an expired session.
When fresh cookies fix the direct test, replace the stale file or return to cookies-from-browser. Stop there instead of changing mpv rendering settings.
3.3 Check file paths and operating system access
Use an absolute path for a cookies file during testing. Relative paths depend on mpv's working directory, which can differ between a terminal, desktop shortcut, file association, media library, and graphical frontend.
- On Windows, verify the drive letter, filename extension, and account permissions.
- On Linux, check file ownership and read permissions for the user launching mpv.
- On macOS, consider privacy controls and application sandbox boundaries when terminal access works but a GUI does not.
- On every system, avoid storing the test file on an intermittently mounted network or removable drive.
Success means the same absolute path works in a direct yt-dlp test and in a clean mpv test. If it works only from one directory, a relative path or launch-environment difference is responsible.

4. Verify the yt-dlp Executable and Frontend Environment
mpv must locate a working yt-dlp executable. Having yt-dlp available in one terminal does not prove that a desktop launcher or frontend can find it.
4.1 Compare executable discovery
In a terminal, identify the executable being used:
yt-dlp --version
On Windows, where yt-dlp can show matching executables. On Linux and macOS, use command -v yt-dlp. Multiple copies can lead to inconsistent behavior, particularly when an older copy is found by mpv while a newer one is found in your interactive shell.
mpv's built-in yt-dlp hook supports specifying the executable path through its script options. A typical command-line test is:
mpv --no-config --script-opts=ytdl_hook-ytdl_path="/absolute/path/to/yt-dlp" --ytdl-raw-options=cookies-from-browser=firefox "https://example.com/video"
Use the actual path for your system. If an explicit path fixes the problem, configure the frontend's environment or retain the explicit hook setting. Download yt-dlp only from its official distribution channels or a trusted operating-system package source.
4.2 Test the frontend launch path
If command-line mpv succeeds but a frontend fails, compare these factors:
- The mpv binary selected by the frontend
- The configuration directory and
mpv.confbeing loaded - The yt-dlp executable visible in the frontend's
PATH - The user account and home directory
- The working directory used for relative cookie paths
- Extra arguments added or removed by the frontend
- Sandbox permissions affecting browser profiles or cookie files
Success means the frontend launches the same mpv and yt-dlp combination with access to the same cookie source. Once command-line and frontend behavior match, there is no reason to alter codecs, GPU drivers, audio backends, display servers, or media tracks.
5. Use Logs and Profiles to Find Overridden Settings
Logs are more useful than trial-and-error changes because they show whether mpv invoked the yt-dlp hook and what category of failure occurred. Keep private data out of any log you share.
5.1 Capture focused terminal output
Run a clean diagnostic command:
mpv --no-config --msg-level=ytdl_hook=debug --log-file=mpv-cookie-test.log --ytdl-raw-options=cookies-from-browser=firefox "https://example.com/video"
Look for evidence that the ytdl hook recognized the URL, found yt-dlp, and attempted extraction. Distinguish among executable-not-found messages, cookie database errors, permission failures, unsupported URLs, network failures, and website authentication responses.
Logs can include URLs, local paths, account-related details, or request information. Redact sensitive values before sharing them, and never publish cookie contents.
5.2 Inspect profiles and conflicting configuration
If the clean test works but your normal configuration fails, re-enable the configuration and inspect likely overrides. Search mpv.conf, included files, profiles, scripts, frontend settings, and shortcuts for these terms:
ytdlytdl-raw-optionsscript-optsytdl_pathprofile
Use mpv --show-profile=PROFILE_NAME to inspect a named profile when you suspect it changes yt-dlp-related options. Replace PROFILE_NAME with the actual profile name. An input binding can also launch a command with different properties or load a profile, so compare playback opened from the command line with playback started through a custom key binding or script.
The stats overlay and track list are useful after extraction succeeds because they confirm selected video, audio, and subtitle tracks. They do not verify cookie loading. If no stream has been extracted, changing track selection, subtitle options, output drivers, hardware decoding, shaders, or HDR settings is premature.
6. Run a Clean Temporary Test Before Editing More Options
Use a controlled sequence so each result identifies one layer. Avoid deleting your configuration folder. A temporary --no-config test is safer and reversible.
- Run yt-dlp directly without cookies and note the exact failure.
- Run yt-dlp with
--cookies-from-browseror a cookies file. - Stop if the second command still fails and resolve its reported cookie or access problem.
- Run mpv with
--no-configand the matchingytdl-raw-options. - If that succeeds, add only the verified cookie option to your normal configuration.
- Test through your normal frontend or desktop launcher.
- If the frontend fails, compare executable paths, environment variables, permissions, and working directories.
Change one variable at a time. Success at step two proves the cookie source works. Success at step four proves mpv can pass that source to yt-dlp. Success at step six proves the normal launch environment is correctly configured. Stop changing settings at the first fully successful stage and preserve the working command for comparison.
7. Quick Fix Checklist
- Confirm the URL works in the signed-in browser profile you intend to use.
- Test
yt-dlp --simulate --cookies-from-browser BROWSER URLbefore opening mpv. - Pass the working source with
--ytdl-raw-options=cookies-from-browser=BROWSER. - For a file, use
--ytdl-raw-options=cookies=/absolute/path/cookies.txt. - Quote URLs and file paths according to your shell.
- Use a simple absolute path to rule out spaces and relative-directory problems.
- Refresh the browser session or cookies file if the cookies are stale.
- Confirm mpv and your frontend can find the same yt-dlp executable.
- Use
--no-configto identify profile, script, or configuration overrides. - Capture
ytdl_hookdebug output instead of changing unrelated video settings. - Do not publish logs until URLs, paths, and account-related details are redacted.
- Stop once extraction and playback work through your normal launch method.
8. Frequently Asked Questions
8.1 Why does yt-dlp work in a terminal but not in mpv?
mpv may not be passing the cookie option, may be finding another yt-dlp executable, or may be launched with a different environment. Test with --no-config, pass the working browser source through ytdl-raw-options, and use an explicit yt-dlp path if necessary. If terminal mpv works but a frontend does not, investigate the frontend's executable, environment, permissions, and working directory.
8.2 Should I use cookies-from-browser or a cookies file?
Use cookies-from-browser when yt-dlp can safely access the correct local browser profile. It avoids manually maintaining an exported file. Use a cookies file when browser extraction is unavailable, when the playback process cannot access the browser database, or when you need a controlled test artifact. Protect either source as sensitive authentication data.
8.3 Why does the cookies file exist but authentication still fail?
The file may contain expired cookies, omit the required domain, use the wrong format, belong to another profile, or be unreadable by the user launching mpv. It may also be referenced through a relative or incorrectly quoted path. Validate it with yt-dlp directly before testing it through mpv.
8.4 Can hardware decoding, HDR, or subtitles break cookie loading?
Normally, no. Those settings apply after a stream has been identified and opened. They can cause playback or rendering problems after extraction, but they do not usually determine whether yt-dlp reads authentication cookies. Investigate them only if the log confirms extraction succeeded and the failure occurs while decoding, rendering, or selecting tracks.
8.5 Why do cookies work from a terminal but fail from a desktop shortcut?
The shortcut may launch mpv with a reduced PATH, another configuration directory, a different working directory, or restricted access to the browser profile. Use absolute paths and compare the mpv and yt-dlp executables used in both environments. A sandboxed frontend may require an allowed file location or different installation method.
8.6 When should I update yt-dlp?
Update through the official yt-dlp method or a trusted package manager when direct yt-dlp output indicates extractor breakage or when the website has changed. First confirm that the problem is not simply a wrong browser profile, stale cookies, or inaccessible executable. Do not install random binaries or codec packs, because codecs do not fix cookie extraction.