Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Omxplayer and subtitles

Sun Jul 22, 2012 6:42 pm

I have soft-coded subtitles with mkvtoolnix on my matroska files, but I can't get them to be visible during playback. The subtitles are visible in the terminal and update as they are supposed to, so why are not they "popping up" on the video?

I have tried opening the files with the "-t"-command, but it doesn't help. I have also tried pressing "s" during the playback, since I read that it would activate them. However, it doesn't.

Do I really need to hard-code subtitles on the files or is there a way to get soft-coded subtitles to work?


PS: The subtitles are soft-coded properly, since I tested them in Windows-environment.

raspberrypivictim
Posts: 30
Joined: Sun Jan 22, 2012 10:35 pm

Re: Omxplayer and subtitles

Mon Jul 23, 2012 6:40 am

Exactly the same happens to me (/viewtopic.php?f=35&t=5543&p=85951#p85951), but I have not come up with a solution yet.

I believe there should be some problem with the fonts packages/framebuffer ... I dont know, just speculating.

I finally gave up and started using open elec, which displays strs files succesfully. I know this is not a solution though.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5614
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Omxplayer and subtitles

Mon Jul 23, 2012 8:50 am

omxplayer doesn't render subtitles to screen currently.
There is a pull request on omxplayer GitHub to add OpenVG subtitle support, but it's not been accepted yet due to coding style and licensing issues.
You could build your own with this enabled, or ask someone to post a prebuilt version.

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Mon Jul 23, 2012 3:19 pm

Thank you for the answers and the suggestions. I'm glad I asked instead of wasting time trying to figure it out myself.

I believe the easiest solution for me is simply hard-code the subtitles on the files (instead of soft-coding), since I have to insert the subtitles to the files anyways.

I now have a different problem and I'm hoping you could help me with it again:
When I put the omxplayer to full-screen (with "-r"), everything works perfectly until I want to stop watching the video. Whenever I press "q" to quit, the video ends as it's supposed to, but my screen remains black and the only way out is to blindly write "sudo reboot" to the terminal. After that, I can see everything again.
This only happens when I use the "-r"-command (without it, I can see parts of my desktop when the video is playing, so it's annoying to watch without using the command).

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5614
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Omxplayer and subtitles

Mon Jul 23, 2012 3:38 pm

@Mauste
Changing TV modes does lose any content on them (e.g. the console framebuffer).

You can provoke the console framebuffer to be recreated with:
fbset -depth 8 && fbset -depth 16

Add that to the end of a script that launches omxplayer.

(for extra points read the depth before launching omxplayer and set it back to original value afterwards)

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Mon Jul 23, 2012 4:07 pm

Thank you very much for your help dom.

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Thu Aug 09, 2012 6:53 pm

I decided to give soft-coded subtitles another try today. I upgraded the omxplayer and the subtitles work perfectly now. All I had to do was press "s" during the playback and it switched subtitles on/ff. Then I pressed left arrow to skip back to beginning and the subtitles started working. For some reason, they don't work until you have skipped a scene. You can change the subtitle-position by typing omxplayer --align center/left (depending where you want them) filename.

I just thought I should reply in case someone stumbles here and sees misinformation.

henle
Posts: 65
Joined: Sat Apr 21, 2012 7:23 pm

Re: Omxplayer and subtitles

Thu Aug 09, 2012 8:04 pm

Mauste, if you want subtitles to appear right away, use the -t option. Changes during playback have a delay.

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Tue Aug 14, 2012 8:23 pm

Yeah I know. The delay was "too long" for my short attention span, which is why I used the "scene-skipping" to "counter" the delay from toggling. Thanks anyways henle.

I have also found that some of my subs do not work for some reason. For example, I have no problems running Doctor Who S02E12 with soft-coded subtitles (made by mkvtoolnix). However, when I try to run Doctor Who S05E01 with soft-coded subtitles (made by mkvtoolnix), the subtitles just don't appear. It happens with more than one file as well.

I am guessing that the problem is related to the subtitle-files and the muxing process with mkvtoolnix. All subtitles have been .srt-format and the video files have been .mkv-format (after muxing). I am also thinking it might be related to 720p and 1080p videofiles, since those are the ones that do not seem to work. It could be a coincidence, but until I test it, I cannot be sure. I will post my findings as soon as I am able.

On a semi-related note: I have installed xbmc to another sd-card and it plays everything well. I am now curious to find out the issue with omxplayer (even though it does not seem to be related to the player itself).


EDIT: After some testing, I came to the conclusion that the problem is with 720p/1080p-files, since the issue appears only when I'm making a .mkv-file from another .mkv-file. The reason why I think this to be the case, is that all the 720p/1080p files have been in the matroska-format before muxing while the lesser quality-files have been in the .avi-format before muxing.

So basically (without looking at the actual values):
.avi + .srt = .mkv works with raspberry pi as well
.mkv + .srt = .mkv doesn't work with raspberry pi, but works in the windows-environment

I will try to test this more by getting my hands on a 720p/1080p-file that is not in the matroska-format. If anyone has some insight, I'm happy to hear it (as always :D)

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Tue Aug 14, 2012 9:25 pm

Sorry to double-post, but I can't edit the post above anymore.
The matroska-container is most likely made with h264-codecs (shows as V_MPEG4/ISO/AVC in mkvtoolnix) and according to mkvtoolnix, the avi-container uses XVID. I am reasonably sure that this is the root of my problem. So, does someone have any ideas on how to get the subtitles to appear in the "h264-files" when using omxplayer? Or am I just doing something wrong again and the answer is really simple and obvious?

henle
Posts: 65
Joined: Sat Apr 21, 2012 7:23 pm

Re: Omxplayer and subtitles

Tue Aug 14, 2012 10:01 pm

Mauste wrote:Sorry to double-post, but I can't edit the post above anymore.
The matroska-container is most likely made with h264-codecs (shows as V_MPEG4/ISO/AVC in mkvtoolnix) and according to mkvtoolnix, the avi-container uses XVID. I am reasonably sure that this is the root of my problem. So, does someone have any ideas on how to get the subtitles to appear in the "h264-files" when using omxplayer? Or am I just doing something wrong again and the answer is really simple and obvious?
The video codec used shouldn't make a difference. Subtitles with complex formatting (SSA) don't work yet, but if you are muxing them in from SRT files, that's not an issue. It would be very helpful if you could upload a short clip that demonstrates the problem.

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Wed Aug 15, 2012 2:42 pm

henle wrote: The video codec used shouldn't make a difference. Subtitles with complex formatting (SSA) don't work yet, but if you are muxing them in from SRT files, that's not an issue. It would be very helpful if you could upload a short clip that demonstrates the problem.
I don't think I can make a short-clip without altering the settings, because I would have to choose settings for rendering. This might result in a different file, which might not represent my issue. However, I have taken screens and I have tried to describe my problem as clearly as possible.

At first I thought the same about the video-codecs, but now I'm not so sure anymore.
Today I had three files: mp4-file, mkv-file and one avi-file. I muxed the approriate subtitles to all of them from .srt-files by using mkvtoolnix (mkvmerge GUI v5.7.0 to be exact). The results were the following:
mp4-file: Video and sound works perfectly in omxplayer, but subtitles do not appear when using "-t on"-command or when toggling them on/off with "s".
mkv-file: Video and sound works perfectly in omxplayer, but subtitles do not appear when using "-t on"-command or when toggling them on/off with "s".
avi-file: Video and sound works perfectly in omxplayer and subtitles appear as they should when using the "-t on"-command or when toggling them on/off with "s".
Note: All three files played flawlessly with sound, video and subtitles in XBMC.

Screens: (I have removed the path to the file)
mp4-file: http://i5.aijaa.com/b/00348/10718117.jpg
mkv-file: http://i6.aijaa.com/b/00496/10718116.jpg
avi-file: http://i6.aijaa.com/b/00277/10718118.jpg
After looking at the screens, I came to the conclusion that it has to be related to the codecs. It uses the same process for srt-files and text subtitles, but the sound and video codecs differ. I don't think it has anything to do with audio-codecs, which only leaves the video-codecs (AVC/h.264 is used for both mp4- and mkv-files).
In short: The subtitles never appear when the file has been made with AVC/h.264-video codec. The subtitles appear normally when the codec is something else than AVC/h.264.

To sum it up: I believe my problem is related to the way how omxplayer handles AVC/h.264-video codecs.
Is there an "official forum" for the omxplayer or a website where I could ask this directly from the guys who made the omxplayer? If there is, can you point me to the right direction?

PS: I made sure I am using the latest omxplayer-build. Am I the only one experiencing this? Could it be that I am missing a certain file? Thanks in advance!

henle
Posts: 65
Joined: Sat Apr 21, 2012 7:23 pm

Re: Omxplayer and subtitles

Wed Aug 15, 2012 8:27 pm

Mauste wrote: [...]
To sum it up: I believe my problem is related to the way how omxplayer handles AVC/h.264-video codecs.
Is there an "official forum" for the omxplayer or a website where I could ask this directly from the guys who made the omxplayer? If there is, can you point me to the right direction?

PS: I made sure I am using the latest omxplayer-build. Am I the only one experiencing this? Could it be that I am missing a certain file? Thanks in advance!
Thank you for the screenshots. Everything looks OK, so I'm not sure why some files don't work - h.264 video with subtitles works for me.

My suggestion is to go to the "Global" tab in mkvmerge GUI, enable splitting after a short duration, and upload a clip somewhere. This doesn't change the video codec, and you can also verify that the problem persists in the new file.

I wrote the subtitle code for omxplayer, so I'll try to fix your problem. :)

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Sat Aug 18, 2012 8:45 pm

I'm sorry for my absence henle. I really appreciate you trying to help me out, especially since you seem to be just the person I was looking for!

I wanted to be as detailed as possible so here are the steps I took:
1) Formatted SD-card
2) Downloaded and installed the recommended raspbian "wheezy" distribution without overclocking
3) In raspi-config: Changed timezone and keyboard layout accordingly, expanded root partition to fill SD-card, changed password, enabled SSH server, updated raspi-config.
4) Rebooted
5) Logged in, started GUI, ran "apt-get install omxplayer" (omxplayer upgraded to the build released on 12.08.2012)
6) moved to the video-file folder
7) Ran the mkv-file that had been made from avi-file (I knew it will play subtitles properly and it did).
8) Ran 3 different mkv-files that had been made from another mkv-file (the ones that didn't play subtitles before). The result was that 0 files played subtitles (just like before).
9) Ran "apt-get install imageMagick" (for screenshotting through terminal and other things)
10) I took screenshot of the "omxplayer info" from the file that played subtitles properly.
11) I took screenshots of the "omxplayer info" from the files that didn't play subtitles properly.

Screenshots
Working file: http://i1.aijaa.com/b/00153/10737309.jpg
Non-working file #1: http://i8.aijaa.com/b/00901/10737310.jpg
Non-working file #2: http://i5.aijaa.com/b/00682/10737311.jpg
Non-working file #3: http://i4.aijaa.com/b/00909/10737312.jpg

I didn't know you could do that with the tool, that's useful. I will make a few short-clips and upload them somewhere, but I am sorry that I couldn't include them to this post. I know it's not likely, since everything seems to be normal, but maybe you'll figure something out from the screenshots alone. Anyways, I'll try to get the clips uploaded as soon as possible. Thank you for your patience!

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Sun Aug 19, 2012 1:34 pm

Here's the link for the short-clip: http://www.speedyshare.com/Rz8Bg/Suits-short.mkv
(click on the text after the word "Download:" to start the download. It's 26 Mb)

The file doesn't show subtitles for me with omxplayer (as expected). However, the subtitles work correctly in windows-environment and with XBMC (as did the others). Can you check if the file plays subtitles for you?

henle
Posts: 65
Joined: Sat Apr 21, 2012 7:23 pm

Re: Omxplayer and subtitles

Mon Aug 20, 2012 12:54 am

Mauste wrote:Here's the link for the short-clip: http://www.speedyshare.com/Rz8Bg/Suits-short.mkv
(click on the text after the word "Download:" to start the download. It's 26 Mb)

The file doesn't show subtitles for me with omxplayer (as expected). However, the subtitles work correctly in windows-environment and with XBMC (as did the others). Can you check if the file plays subtitles for you?
I noticed you didn't change the memory split with raspi-config, so I think the problem is that there is not enough memory in the GPU for subtitles for certain files. Try the 128/128 split.

Mauste
Posts: 29
Joined: Thu Jul 19, 2012 1:15 pm

Re: Omxplayer and subtitles

Mon Aug 20, 2012 9:13 am

henle wrote: I noticed you didn't change the memory split with raspi-config, so I think the problem is that there is not enough memory in the GPU for subtitles for certain files. Try the 128/128 split.
Ahh yes, of course. I don't know why I didn't realize to try that...now I feel a bit silly. I guess it's true what they say about multiple eye-pairs and all that.

Anyways, the subtitles work perfectly for all files now. Thank you for your help, you are awesome.

amyren
Posts: 91
Joined: Tue Jun 12, 2012 10:49 am

Re: Omxplayer and subtitles

Tue Aug 21, 2012 7:07 am

Mauste wrote:Thank you for the answers and the suggestions. I'm glad I asked instead of wasting time trying to figure it out myself.

I believe the easiest solution for me is simply hard-code the subtitles on the files (instead of soft-coding), since I have to insert the subtitles to the files anyways.

I now have a different problem and I'm hoping you could help me with it again:
When I put the omxplayer to full-screen (with "-r"), everything works perfectly until I want to stop watching the video. Whenever I press "q" to quit, the video ends as it's supposed to, but my screen remains black and the only way out is to blindly write "sudo reboot" to the terminal. After that, I can see everything again.
This only happens when I use the "-r"-command (without it, I can see parts of my desktop when the video is playing, so it's annoying to watch without using the command).
Just a short tip for you if you run it without the -r option. To see less of the desktop when the video plays do these adjustments,
- set the desktop background colour to black.
- arrange the desktop icons so that they are in the middle part of the screen.
- set up the menubar to auto-hide when not in use.

This way you will only have black borders on top and bottom when playing the videos on your desktop.

Krassegrand
Posts: 105
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden

Re: Omxplayer and subtitles

Sun May 17, 2015 3:18 pm

Is this the right place to post about subtitles?
I don't get ÅÄÖ on Swedish subs.
And what do I do if the subs are already in the info in the .mkv-file.
With vlc I right click on the screen and select the preferred subs.
I have tried using m and n on the keyboard.

Jörgen

Return to “General discussion”