Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitles in a mkv are not showing #1

Closed
olofsjod opened this issue May 31, 2012 · 4 comments
Closed

Subtitles in a mkv are not showing #1

olofsjod opened this issue May 31, 2012 · 4 comments

Comments

@olofsjod
Copy link

Hi, when I trying to play an mkv it seems that the subtitles, who are whitin the mkv, are not showing. I'm using the command

~$ omxplayer random.mkv

to start the mkv, but also tried

~$ omxplayer -t y random.mkv

where y is a number, I tried from 0 to 5.

I've read at the raspberry pies official forum that I needed to press the S key to start the subtitles. It didn't work.

I really like your program, could we solve the problem please? =)

@huceke
Copy link
Owner

huceke commented May 31, 2012

It depends on the embeded subtitle format. omxplayer only supports text
based subtitles.

2012/5/31 Olof Sjödin <
reply@reply.github.com

Hi, when I trying to play an mkv it seems that the subtitles, who are
whitin the mkv, are not showing. I'm using the command

~$ omxplayer random.mkv

to start the mkv, but also tried

~$ omxplayer -t y random.mkv

where y is a number, I tried from 0 to 5.

I've read at the raspberry pies official forum that I needed to press the
S key to start the subtitles. It didn't work.

I really like your program, could we solve the problem please? =)


Reply to this email directly or view it on GitHub:
#1

@huceke
Copy link
Owner

huceke commented May 31, 2012

It depends on the embeded subtitle format. omxplayer only supports text based subtitles.

Edit:

But not displaying them.

@olofsjod
Copy link
Author

Thank you for your (quick) answer! So I guess if i extract the subtitles from the mkv and then use it with omxplayer will get around the issue?

@opensiriusfox
Copy link

I did some poking around and found the offending code for this bug. Currently there is a check (line 429 of omxplayer.cpp) that checks to make sure the requested subtitle index is not higher than the subtitles available in the file. The problem is that this check is also the only place where subtitles are actually enabled in the player. So unless the user requests a subtitle track index that is too high, the subtitles won't play, and even then, only the highest one will be played. The solution is to break this into two checks as below.

While this does cause subtitles to be read, they are currently only output to the command line, typically behind the video being displayed on the screen. It appears that currently this only supports embedded SRT style subtitles, not the SSA style more commonly bundled with MKV videos.

Original

  if(m_has_subtitle && m_subtitle_index > (m_omx_reader.SubtitleStreamCount() - 1))
  {
    m_subtitle_index = m_omx_reader.SubtitleStreamCount() - 1;
    m_omx_reader.SetActiveStream(OMXSTREAM_SUBTITLE, m_subtitle_index);
    m_show_subtitle = true;
  }
  else
  {
    m_show_subtitle = false;
  }

Replacement

  // This is an upper bound check on the subtitle limits. When we pulled the subtitle
  // index from the user we check to make sure that the value is larger than zero, but
  // we couldn't know without scanning the file if it was too high. If this is the case
  // then we replace the subtitle index with the maximum value possible.
  if(m_has_subtitle && m_subtitle_index > (m_omx_reader.SubtitleStreamCount() - 1))
  {
    m_subtitle_index = m_omx_reader.SubtitleStreamCount() - 1;
  }

  // Here we actually enable the subtitle streams if we have one available.
  if (m_has_subtitle && m_subtitle_index <= (m_omx_reader.SubtitleStreamCount() - 1))
  {
    m_omx_reader.SetActiveStream(OMXSTREAM_SUBTITLE, m_subtitle_index);
    m_show_subtitle = true;
  }
  else
  {
    m_show_subtitle = false;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants