mpv-player / mpv-player/mpv

ytdl_hook-ytdl_path does not expand $HOME path ~/ correctly

Open
#16,824 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

os:mac
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

mpv Information
mpv v0.40.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on May  7 2025 22:20:34
libplacebo version: v7.349.0
FFmpeg version: 6.1.2
FFmpeg library versions:
   libavcodec      60.31.102
   libavdevice     60.3.100
   libavfilter     9.12.100
   libavformat     60.16.100
   libavutil       58.29.100
   libswresample   4.12.100
   libswscale      7.5.100
Other Information
- macOS version: macOS 26.0 (25A354)
- Source of mpv: homebrew cask
- Latest known working version: I can't remember definitively, but I feel like this used to work on macOS at one point
- Issue started after the following happened: upgrading mpv
Reproduction Steps

I'm pretty sure ~/ in my mpv.conf used to automatically expand-path ~/ to /Users/johnduncan/, but that doesn't seem to work anymore.

Since yt-dlp is in my path by default thanks to a symlink in /opt/bin/, I can just specify ytdl_hook-ytdl_path=yt-dlp, but I'm wondering why the fully qualified ~/.local/bin/yt-dlp path no longer works?


~/.config/mpv/mpv.conf

script-opts-add=ytdl_hook-ytdl_path="~/.local/bin/yt-dlp"

I'm using uv, but it also happens if I install yt-dlp from homebrew.

$ uv tool install yt-dlp

$ file ~/.local/bin/yt-dlp
file is /usr/bin/file
/Users/johnduncan/.local/bin/yt-dlp: a /Users/johnduncan/.local/share/uv/tools/yt-dlp/bin/python3 script text executable, ASCII text

$ stat ~/.local/bin/yt-dlp
stat is /usr/bin/stat
16777232 281646344 lrwxr-xr-x 1 johnduncan staff 0 57 "Sep 14 17:48:42 2025" "Sep 14 17:48:42 2025" "Sep 14 17:48:42 2025" "Sep 14 17:48:42 2025" 4096 0 0 /Users/johnduncan/.local/bin/yt-dlp

broken

$ mpv "https://www.youtube.com/watch?v=C0DPdy98e4c" --script-opts=ytdl_hook-ytdl_path="~/.local/bin/yt-dlp"

works

$ mpv "https://www.youtube.com/watch?v=C0DPdy98e4c" --script-opts=ytdl_hook-ytdl_path="/Users/johnduncan/.local/bin/yt-dlp"

$ mpv "https://www.youtube.com/watch?v=C0DPdy98e4c" --script-opts=ytdl_hook-ytdl_path=yt-dlp


Expected Behavior

mpv "https://www.youtube.com/watch?v=C0DPdy98e4c" --script-opts=ytdl_hook-ytdl_path="~/.local/bin/yt-dlp should work

Actual Behavior

mpv "https://www.youtube.com/watch?v=C0DPdy98e4c" --script-opts=ytdl_hook-ytdl_path="~/.local/bin/yt-dlp" fails with:

[ytdl_hook] Subprocess failed: init
[ytdl_hook] 
[ytdl_hook] youtube-dl failed: not found or not enough permissions
Failed to recognize file format.
Image
Log File

output.txt

Relevant section is:

[   0.070][d][global] config path: '~/.local/bin/yt-dlp' -/-> '/Users/johnduncan/.config/mpv/~/.local/bin/yt-dlp'
[   0.070][d][global] config path: '~/.local/bin/yt-dlp' -/-> '/Users/johnduncan/.mpv/~/.local/bin/yt-dlp'
[   0.070][d][global] config path: '~/.local/bin/yt-dlp' -/-> '/usr/local/etc/mpv/~/.local/bin/yt-dlp'
[   0.070][v][ytdl_hook] No youtube-dl found with path ~/.local/bin/yt-dlp in config directories
[   0.070][d][cplayer] Run command: subprocess, flags=64, args=[args="~/.local/bin/yt-dlp,--no-warnings,-J,--flat-playlist,--sub-format,ass/srt/best,--format,bestvideo+bestaudio/best,--extractor-args,youtube:skip=hls,--mark-watched,--format-sort,proto,--cookies-from-browser,chrome,--sub-langs,all,--write-srt,--no-playlist,--,https://www.youtube.com/watch?v=C0DPdy98e4c", playback_only="yes", capture_size="67108864", capture_stdout="yes", capture_stderr="yes", detach="no", env="", stdin_data="", passthrough_stdin="no"]
[   0.070][v][ytdl_hook] Starting subprocess: [~/.local/bin/yt-dlp, --no-warnings, -J, --flat-playlist, --sub-format, ass/srt/best, --format, bestvideo+bestaudio/best, --extractor-args, youtube:skip=hls, --mark-watched, --format-sort, proto, --cookies-from-browser, chrome, --sub-langs, all, --write-srt, --no-playlist, --, https://www.youtube.com/watch?v=C0DPdy98e4c]
[   0.071][v][cplayer] Set property: user-data/osc/margins={"b":0,"l":0,"t":0,"r":0} -> 1
[   0.071][d][osc] osc_init
[   0.072][e][ytdl_hook] Subprocess failed: init
[   0.072][v][ytdl_hook] youtube-dl with path ~/.local/bin/yt-dlp not found in PATH or not enough permissions
Sample Files

No response

I carefully read all instruction and confirm that I did the following:
  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ytdl_hook path handling and the config-path behavior shown in the attached log. Reproduce the broken and working commands using ytdl_hook-ytdl_path, then trace where the literal ~/ path is passed to the subprocess. Done means the documented ~/.local/bin/yt-dlp form works as expected without breaking absolute paths or PATH lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.