mpv
mpv copied to clipboard
Vobsub sub file loading doesn't work for URI with non-ASCII path
Important Information
Provide following Information:
- mpv version 0.35.0
- Platform and Version Gentoo Linux
- Source of the mpv binary Tried both using package manager and manual git build
Reproduction steps
- Obtain vobsub idx and sub file
- Open a video in any way
- Drag the vobsub idx file onto the video
- Notice error in mpv log saying
[ffmpeg/demuxer] vobsub: Unable to open path/to/file as MPEG subtitles
[lavf] avformat_open_input() failed
It seems these are the necessary conditions for the bug:
- File drag (so path is using URI which is encoded)
- Non-ASCII characters in path (so enocoding is non-trivial)
The idx file loads fine, the sub file fails. It looks like the idx file gets the URI decoded internally in MPV before being passed to ffmpeg but this does not happen for the sub file.
I tried to fix this myself in demux/demux_lavf.c::guess_and_set_vobsub_name by calling mp_file_get_path and that made loading work but the subs didn't get displayed at all anymore, with no changes they get displayed but incorrectly, so I gave up
Expected behavior
It loads the sub file and the subtitles are displayed correctly
Actual behavior
It doesn't load the sub file and the subtitles are displayed incorrectly
Log file
[lavf] Found 'vobsub' at score=100 size=2048.
[lavf] Assuming associated .sub file: file:///home/sarnex/Desktop/%E3%82%AB/subs.sub
[ffmpeg/demuxer] vobsub: Unable to open file:///home/sarnex/Desktop/%E3%82%AB/subs.sub as MPEG subtitles
[lavf] avformat_open_input() failed
[ffmpeg/demuxer] vobsub: Unable to open file:///home/sarnex/Desktop/%E3%82%AB/subs.sub as MPEG subtitles
[lavf] avformat_open_input() failed
Can not open external file file:///home/sarnex/Desktop/%E3%82%AB/subs.idx.
Sample files
I can upload the vobsub files I'm using but any should repro the issue
PR: https://github.com/mpv-player/mpv/pull/10862