Howto Map Mplayer Subtitle Commands on a Remote Control

I’ve been looking for a example where I could see, how subtitles for mplayer can be mapped on a remote control. But my search have been quite unsuccessful. Looking for lircrc, example, subtitles and mplayer didn’t return anything meaningful.

And if you build (check out) mplayer from source, there is a file called input.conf in the etc directory, where you can look up the mapping of the keyboard. At least I thought so. In the man page you can read:

j
Cycle through the available subtitles.

but in the input.conf file there is no “j” and the appropriate command for it, which I could have used in my lircrc.

I still can’t believe that there isn’t an easy way to find an lircrc example, where this mapping can be looked up. It took me almost half an hour to find the appropriate commands for lircrc. Here they are:

command comment key on keyboard
osd toggle the visibility of the On Screen Display o
sub_visibility toggle the visibility of the subtitle v
subvob_lang cycle through all available subtitle languages. j
switch_audio cycle through all available audio languages. #

So with this knowledge my .lircrc mplayer part for the subtitles looks like this (you need an appropriate lircd.conf, create it with irrecord):

begin
     remote = my_remote.conf
     prog = mplayer
     button = red
     config = vobsub_lang
end
begin
     remote = my_remote.conf
     prog = mplayer
     button = green
     config = sub_visibility
end
begin
     remote = my_remote.conf
     prog = mplayer
     button = blue
     config = switch_audio
end
begin
     remote = my_remote.conf
     prog = mplayer
     button = yellow
     config = osd
end

With this lircrc I can switch through all available subtitles, hide and make them visible again, and I can also switch through all available audio tracks.

Info:

  • I usually build mplayer from source on a Ubuntu system with an Nvidia gfx card (here a x86_64 Jaunty Jackalope 9.04) like this:

    aptitude build-depends mplayer
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    cd mplayer
    ./configure --disable-x264-lavc --disable-x264 --enable-vdpau --enable-menu --prefix=/usr
    make && make install

  • the switch_audio and osd commands aren't necessary in this example, but I've added them, because most of the people would add them anyway. --enable-menu is only needed in order to have On Screen Display (osd). It shows you e.g, if the playback is paused, the progress indicator of the movie (position), or the percentage of the position. The part with relation to subtitles is, that you can see the subtitle language while changing them if osd is enabled. You can see in the little opening image in the upper left how it looks like. The osd button turns this display on and off again.

Hope, I could help.

Maybe Related Posts



5 Responses to “Howto Map Mplayer Subtitle Commands on a Remote Control”


  1. bob

    If you get an error regarding missing vdpau.h and vdpau_x11.h you need to get nvidia vdpau’s header/X11:

    Download both .h files here:
    ftp://download.nvidia.com/XFree86/vdpau/include/vdpau/

    You can put them in /usr/include/vdpau/ for future usage and make a virtual link from inside the newly created “mplayer” directory (following svn checkout):

    ln -s /usr/include/vdpau/ vdpau

  2. acmelab68

    @bob
    Excellent comment. Thanks. Of course not every one in the world uses an Nvidia gfx card, for which this mplayer VDPAU example is ment for.

    For non-Nvidia-users just use this lines:

    ./configure --enable-menu --prefix=/usr

    Or the default package should do actually the same trick (not verified).

    Thanks again!

    Regards

  3. Dano

    Great info! Really needed this for some Japanese videos loaded up on my system.
    Thanks!

  4. Federico

    GREAT!!
    These commands seems not to be so easy to find…

    thank you a lot!

    FF

  5. Nico

    Thx I had been searching for the mplayer # equivalent in LIRC for an hour until I hit this page!