MythTV Setup Series- Use Alternate Player

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

The MythTV internal player uses FFmpeg, which isn't a player, but it is the internals used by many popular players, such as mplayer. Many FFmpeg developers are also part of the MPlayer project. FFmpeg is used by VLC media player, MPlayer, xine, HandBrake, and others. With that being said, the MythTV implementation seems to have limitations. It's not the best at playing some types of media that might be in your media library outside of the recordings made by MythTV. It doesn't digest highly compressed H.264 video very well. It seems to have problems tracking and refreshing properly on them, much like can be observed with SMPlayer. In fact, I have found videos that play best in VLC and others that play best in SMPlayer. Although VLC, like the MythTV player, uses FFmpeg, VLC has a wide variety of internal codecs and can play certain videos much better.

Users want the option to use an alternate player other than the internal player for playing videos in their media library.


MythTV has an option in the settings to configure an alternate player to use IN ADDITION to the internal player! Our goal here is to configure VLC as the alternate player.

Using VideoLAN Player for playback in MythTV (otherwise known as VLC Player) for all video files or certain video files.

The location in the Front End is:

  • Setup, Media Settings, Video Settings, Player Settings

However, due to the way MythTV uses STORAGE GROUPS for your video files (those not recorded using MythTV), VLC will not find the video at the path passed to it by MythTV. If you have MythTV configured to access a path containing video files (such as a LAN path or NFS path, or even local) the MythTV Frontend sees this in a Storage Group. SG = Storage Group. MythTV will not allow Storage Group content to be played with an external player such as VLC.

For example, /var/lib/mythtv/videos is seen by MythTV and sent to the external player as myth://Videos@localhost, which is a storage group path.

There are two working hacks we will cover here:

HACK #1: Local Video Storage Hack:

If you choose not to use Storage Groups then simply don't define any of the above mentioned Storage Groups and set up your directories for videos and artwork on each individual front-end. On remote front-ends the directories will need to be mounted locally via NFS or Samba. As always, the mount points need to be identical on all front-ends. Then go to Utilities/Setup->Setup->Media Settings->Video Settings->General and point to the appropriate directories for Videos, Trailers, Fan art, Banners, Screenshots, and Cover art.

HACK #2: Parsing the Parameter with a Shell Script

This is by far the best hack of the two, because you can continue to use storage groups, and you need not set up the static paths on each individual front-end. Rather than setting the alternate player to vlc in (Setup, Media Settings, Video Settings, Player Settings) set it to the name of an intermediary shell script. I called my shell script by the name 'altplayer.'

You can put the video in a place like /usr/local/bin/ and after you finish with the code make the script executable.

vi /usr/local/bin/altplayer
chmod +x /usr/local/bin/altplayer

The code in my altplayer shell script is as follows:

#!/bin/bash
strPlayer=${1/"myth://Videos@192.168.1.2:6543"/"/mnt/video"} 
vlc -f "$strPlayer" --no-embedded-video vlc://quit
exit 0

The script will need to be modified for your particular network and cifs path. For additional information the subject is covered in the Official MythTV Wiki (MythTV VLC).

Now that you have VLC working as your alternate player, you may wish to remap the key that allows you to exit back to the MythTV Frontend to be consistent with the one that the MythTV internal player uses.

  1. On the VLC Menu bar click the Tools menu and choose "Preferences" from the menu. (or press ctrl-p)
  2. Click on the "Hotkeys" icon and find the value for "quit" and assign it to the escape key.

The default key to quit VLC is ctrl-q which might be fine for you so you won't need to change the mapping.

ISSUE: The xfce4 Panel May Sometimes Be Visible During VLC Full Screen Playback

This is a glitch part in the way VLC uses Qt. The Qt window states are: Normal, FullScreen, Minimized, Maximized. The glitch has to do with the way VLC was last used when ran independent of MythTV. If vlc was used in the Window Maximized state and exited in that state, later when launched from within MythTV, even though it is now in the FullScreen state, Qt glitch causes XFCE panel to remain visible. The issue is confirmed in Mythbuntu 12.04 Qt4 VLC 2.0.8. A simple workaround was implemented here by adding --no-embedded-video to the vlc command line in our altplayer script.