mpv-player / mpv-player/mpv

Vobsub sub file loading doesn't work for URI with non-ASCII path

Open
#10,860 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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
  1. Obtain vobsub idx and sub file
  2. Open a video in any way
  3. Drag the vobsub idx file onto the video
  4. 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:

  1. File drag (so path is using URI which is encoded)
  2. 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

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

Read demux/demux_lavf.c, especially guess_and_set_vobsub_name, and reproduce by dragging a VobSub .idx from a path containing non-ASCII characters. Compare URI handling for the .idx and associated .sub; done means the .sub opens and subtitles display correctly.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.