Difference between revisions of "Video Library"

From MythTV Official Wiki
Jump to: navigation, search
(Internal Player)
Line 1: Line 1:
[[MythVideo]] allows for cataloguing and playback of a variety of video file formats. It can perform automatic meta data look ups on [[Tmdb.pl|themoviedb.org]] or [[Ttvdb.py|The TV DB]] as well as retrieve poster, fanart, banner, and screenshot artwork.  You can also add your own Meta data to your own videos and add custom poster artwork to videos.
|'''The information on this page pertains to 0.21.  If upgrading to 0.22, see [[MythVideo .22 Transition Guide]] for a large explanation of changes.'''
[[MythVideo]] allows for cataloguing and playback of a variety of video file formats.  It can perform automatic meta data look ups on [[Tmdb.pl|themoviedb.org]] or IMDB as well as retrieve poster artwork.  You can also add your own Meta data to your own videos and add custom poster artwork to videos.
It features four different "views" on your collection:
* Browse View
It features three different "views" on your collection:
* Tree View
* Browse view - Shows a single video on screen at once with its metadata.
* Gallery View
* Tree view - Presents your videos in a view similar to the watch recordings screen.  This view can be configured to show file/subdirectories.
* Manage View
* Gallery - Presents you with numerous titles at once laid out in a view similar to [[MythGallery]].
[[MythVideo]] can use MythTV's [[Internal player|internal media player]], to play back the video files, by specifying "Internal" as the player. Optionally, it can be configured to use external players such as Xine or mplayer.
[[MythVideo]] can use MythTV's [[Internal player|internal media player]], to play back the video files, by specifying "Internal" as the player. Optionally, it can be configured to use external players such as Xine or mplayer.

Revision as of 17:07, 12 November 2009

MythVideo allows for cataloguing and playback of a variety of video file formats. It can perform automatic meta data look ups on themoviedb.org or The TV DB as well as retrieve poster, fanart, banner, and screenshot artwork. You can also add your own Meta data to your own videos and add custom poster artwork to videos.

It features four different "views" on your collection:

  • Browse View
  • Tree View
  • Gallery View
  • Manage View

MythVideo can use MythTV's internal media player, to play back the video files, by specifying "Internal" as the player. Optionally, it can be configured to use external players such as Xine or mplayer.


MythVideo is a plugin module for MythTV. It is installed by default with Myth focused distributions like MythBuntu. If you install MythTV manually, the plugin modules are not automatically installed. You can see that MythVideo is not installed because the 'Watch Videos' menu item is missing from the Media Library sub menu.

Instructions For Specific Distributions

Debian derived (Ubuntu etc)

From a command shell or konsole window, type or paste this command

sudo apt-get install mythvideo

Then restart MythTV. It should load available modules.

openSUSE 11.1

  • Add the packman repository if you haven't already (this should have been done to install MythTV though).
 zypper addrepo http://packman.mirrors.skynet.be/pub/packman/suse/11.1 Packman
  • Install it:
 zypper install mythvideo
  • Create the movie poster directory. NOTE: tv is the name I have chosen for the user who will be running mythfrontend, substitute whatever user ID you will use.
 mkdir ~tv/.mythtv/MythVideo;chown -R tv ~tv/.mythtv

Common Instructions

Now read MTD, which you'll also need.


Setting up Video and Image Folders

Storage Groups

Videos in Myth can now be stored on the backend and streamed to the frontend without a NFS or Samba mount. It is critical to note that the Storage Group implementation is not complete, and to take that into consideration when weighing whether to move to MythVideo Storage Groups. Hopefully the transition to Storage Groups will be complete for MythTV .23, so this should be taken as a technology preview release only.


  • Adding new frontends means zero configuration for videos, recordings, and metadata images.
  • Can dynamically add space to your video library without using RAID or LVM. Loss of one drive does not mean loss of the entire library.
  • Can spread video hosting across many/all backends.
  • No need to set up network mounts of any kind.


  • External Video Players (mplayer, xine, VLC) will not work with videos hosted on an SG. (Fix planned for .23)
  • ISO/VIDEO_TS Playback does not presently work in Storage Groups (Fix planned for .23)

Setting Up Video/Image Storage Groups

  1. On the backend to host the videos, stop the backend process and run mythtv-setup.
  2. In Storage Group configuration, set up directories for each of the following: Videos, Fanart, Banners, Screenshots, and Coverart.
  3. Optional Step: If you would like to use a combination of Storage Group and locally hosted video, you can do the following. On the frontends, go to Utilities/Setup->Setup->Media Settings->Video Settings->General. Change "Directories that hold videos" to point at a directory that is not the same as the one the Storage Group points at. If the local video setting and the Storage Group setting point at the same path, MythVideo will prefer the Storage Group path and ignore the local one.
  4. Enter MythVideo. Press the "M" (MENU) key and choose "Scan For Changes."
  5. You will find that your metadata is reset, but should see all of the Storage Group videos. You will need to regrab metadata, but there are multiple new options to grab it all quickly in .22, as explained below.

Local Video Storage

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 frontend. On remote frontends the directories will need to be mounted locally via NFS or Samba. As always, the mount points need to be identical on all frontends. Then go to Utilities/Setup->Setup->Media Settings->Video Settings->General and point to the appropriate directories for Videos, Fanart, Banners, Screenshots, and Coverart.

Folder Images

You can place a file named folder.(png | gif | jpg) into a folder that is accessible to MythVideo and it will be used when the gallery view is displayed instead of a plain folder icon.

Internal Player

The MythTV Internal player is the default (and recommended) player for Video and DVD. It will also play DVDs and DVD isos with full menu and subtitle support. It uses the same OSD, settings, remote bindings and audio configuration as playback of recordings making it much easier to setup and use than an external player. It supports almost all video formats and content including High Definition and in addition a wide range of easily accessible features including configurable aspect ratios, picture fill modes, timestretch, bookmarks, video editing, automatic locale based or manual selection of subtitle and audio streams and much, much more.

Rebuild seek table

Some files require a seektable in order to skip/seek properly. To create a seektable, run the following command on the file:

 mythcommflag --rebuild --video filename.ext

The symptoms are the internal player not displaying the correct time in the OSD, not seeking at all, or restarting playback on any attempt to seek.

Importing DVDs

There are multiple ways to import DVD's to your MythTV system.

Importing with Frontend

To import a DVD using you frontend system, click on "Import DVD" from your "Optical Disks" item on the MythFrontend Front Page. For more information see the DVD Ripping page.

Importing with Networked Computer

MythDVD can rip DVDs into your MythVideo folders but it does tie up a frontend. You may wish to rip DVDs on other machines on your network e.g. your fileserver. I've found the following procedure works well:

  • Run lsdvd to find the largest DVD title, it's usually 1.
  • Run vlc, pick File/Open Disc and select that title.
  • Check VLC plays the programme you want and gets to the end credits (skip forward).
  • Stop playback and pick File/Open Disc again, select the track and click Stream/Save and then Settings... (screen shot)
  • In the Stream output dialog click File in the Outputs box and fill in the Filename, select MPEG PS and Select all elementary streams.
  • Click OK and VLC will rip the track into the chosen file.
  • Test the rip with something else like mplayer.

At this point MythVideo can see the file but you might want to go into the VideoManager on a frontend so you can fix the metadata, grab a poster etc.

If you're using an external player you're finished but if you're using the Internal player you won't be able to skip forward or backward until you add a seektable for the file. To do this I run

mythtranscode --mpeg2 --video --buildindex --infile "<Movie>.mpg"

It may leave a zero length file called <Movie>.tmp which you can remove.

The mythcommflag man page indicates it can also do this but it fails dismally for me, maybe because DVD MPEG streams can (and do) change characteristics midstream. Other DVD ripping methods are available but VLC has given me the best results. Simply copying the DVD files or using vobcopy doesn't work well.

Wrong audio track on playback

Select all elementary streams in a VLC rip will grab all the audio tracks available. The Internal player can switch among them from the OSD but you may get annoyed at having to do this every time. You can trim out the offending tracks permanently with

ffmpeg -i Movie.mpg
mv Movie.mpg Movie.mpg.bak
mpegdemux --remux --stream 0xe0/0xbd --substream <audio> Movie.mpg.bak Movie.mpg

ffmpeg -i will list out the streams, the stream numbers you want are the numbers in square brackets starting with 0x., they usually start at 0x80. The --substream option to mpegdemux selects which audio streams to include. It can take the form 0x81/0x82/0x83 as a list, 0x81-0x83 as a range or -0x80 as an exclusion.

You will have to rebuild the seektable if using the Internal player.

Parental Controls

MythVideo supports the ability to limit what videos maybe viewed without a password/pin. There are 4 different levels that a video/file can be set at. From within the configuration you can select a default level and a password/pin for each level. Any videos/files at or below the current level will show up in the list. Use Video Manger to change the level of any particular video (must be done on a video-by-video case, or with a hack like this one).

MythVideo will only stay at that level until you try to change the level (by hitting keys 1-4 in the Browse or List screens), or exit out of MythVideo to the main frontend menu. Changing to a level which has a password/pin set will require the pin to be entered. MythVideo remembers that you entered the pin for 2 minutes, so once you've entered the pin for a given level, you can freely switch between that level and all lower levels without a pin until that two minutes is up, after which you'll need to enter a pin again to switch to a higher level.

External Player Configuration

To choose an external player (mplayer, Xine, etc.), you will need to delve into your MythVideo setup.

At the main screen, scroll down to Setup, then Video Settings, then Player Settings. Here you'll see a box which contains the command line MythFrontend will launch your video file with. %s is a variable which corresponds to the file path and name of the file you're going to play. All you need to do is edit this command line to run whatever player you like. The %s string expansion appears to be broken in version 0.20; it no longer contains the entire path, but only the file name.

Please note that if you use MythVideo to launch external players, you must have a window manager configured and running so that window focus can change from MythFrontend to the media player. Compatible window managers include those built into KDE and Gnome, Ratpoison, Fluxbox, and I imagine many more.

mplayer Configuration

The default configuration uses mplayer

 mplayer -fs -zoom -quiet -vo xv %s

If you have audio sync problems, try changing the audio system to OSS

 mplayer -fs -zoom -quiet -ao oss -vo xv %s

Information.png Tip: If you want to disable xscreensaver while you're watching a video with mplayer add this to /home/mythuser/.mplayer/config


Mplayer Playlists

You can create a playlist containing a list of video files to play continuously one after another. This is great for music videos at a party or combining movies downloaded in several parts.

There's no way to create the playlist from within mythtv, so you'll have to log in and do it from the shell. Use any text editor to create playlist files with 1 filename per line and use the extension .pls. You can also pipe a directory listing to a file. Mplayer doesn't seem to like spaces in filenames so you'll need to rename files or they will be skipped over. -EDIT- The playlist feature of mplayer chokes on filenames that have escaped spaces. Remove the backslashes from the list of filenames in the playlist by using a text editor like vi and they won't be skipped.

 dir * > all_videos.pls

At the main screen, scroll down to Utilities/Setup, then Setup, then Media Settings, then Video Settings, then File Types. You'll need to add a new file association for playlists and provide the command to play them.

Select New, then enter pls (without a period) and select Create new extension. Select the Command box and enter

 mplayer -fs -zoom -quiet -vo xv -playlist %s

If you are using xscreensaver you can add the option


to prevent the screensaver kicking in while watching the video. Make sure the default and ignore boxes are not checked.

Add -shuffle after mplayer if you want them played in random order.

Don't forget to run the video manager so MythTV notices the new playlist file. The playlist file will now show up in the list of videos.

While they're playing, use < and > to jump to the previous or next file. If using a remote with lirc, the config commands to achieve this are pt_step -1 and pt_step +1.

To have a playlist dynamically regenerated each time it's played, a small script can be used as the custom command: MythVideo:playRandom.sh

Xine Configuration

Main Article: Configuring Xine

Xine is a popular media player under Linux. Xine can be configured to work with a remote control.

Running man xine from the terminal will get you an exhaustive list of the many options Xine can be run with, but the following is a good default:

 xine -pfhq --no-splash

-p specifies "autoplay", f starts in fullscreen mode, h hides the GUI (if you've installed xine-ui) and q means that xine will exit after the video finishes playing, returning you to MythVideo. --no-splash disables the splash screen that Xine usually starts with.

Further Xine Configuration

It seems that xine has a rather annoying habit of reverting back to the default keys even after configuring them, and that several functions overlap each other (the prev/next mrl function and the prev/next chapter buttons are an example). The easiest way to solve this problem is to edit the keymap file ($HOME/.xine/keymap usually) or just use the keymap editor in xine_gui if you have it installed, and set up the keys how you'd like, in my case one for watching vids and another for watching dvds. Then copy the keymap file to something similar to keymap.video and/or keymap.dvd. Then enter this as your default player (using the above configuration as a base).

xine -pfhq --no-splash --keymap=file:/path/to/.xine/keymap.video %s

This tells xine to load the keymap from the specified file. After doing this xine decided to behave and has been working nicely for some time.

Per-file Configuration

Individual videos can be configured using the video manager at Main Screen->Utilities /Setup -> Video Manager.

You can also run specified files with a non-standard command. While in the video manager, if you hit enter on a specific file, you are presented with the settings for that file. The categories here are fairly self explanatory, but in the Unique Player Command box at the bottom you can specify different parameters to launch the file with.

If your movie comes in two or more parts, you can specify the file you always want to play next under File to Always Play Next. For example, if I'm editing "A Film Too Long CD1", I can shift left and right until I find "A Film Too Long CD2" and so on. This will give you seamless playback of your chosen flick.

Metadata Lookup

MythVideo comes bundled with some cute scripts to look up details about your film over the internet. When you're in the Video Manager, hit i to bring up the info screen. Here you'll see an option to Search IMDB. Hit enter, and the script will tootle along over to the Internet Movie Database and retrieve details about the film as well as a poster of it.

Please note that the IMDB script relies on you having accurate filenames; if your film is named "@ f1lm 2 l0ng", the script isn't going to work. In this case, you can either use the Edit Metadata function to rename the movie within MythVideo and then re-attempt the Search IMDB option, or you can rename the file within the actual Linux OS. Alternatively, you can enter the IMDB reference number manually. You can get this number by looking up your film on the IMDB website, and noting the number in the URL that follows the tt. For instance, Akira http://imdb.com/title/tt0094625/ has an IMDB number of 0094625. If you type this into the Manually Enter IMDB # input, the IMDB grabber script will shoot off and grab the data for you.

In case the IMDB grabber script gets confused - sometimes different films have very similar names - the results are returned in order of popularity, as well as having their year of release shown in brackets. This should be enough for you to work out which is the correct entry.

It's also important to note that certain versions of MythVideo have issues when trying to fetch movie information with the included IMDB Script. If you aren't getting the plot, director, ratings, etc, then you are probably going to want to fix this. The steps provided below have been copied from this site. The fix is pretty simple:

First create a backup of the original script

 sudo cp /usr/share/mythtv/mythvideo/scripts/imdb.pl /usr/share/mythtv/mythvideo/scripts/imdb.pl-orig

Download the SVN Copy (now in an older Revision 18604)

 wget "http://svn.mythtv.org/trac/export/18604/trunk/mythplugins/mythvideo/mythvideo/scripts/imdb.pl" -O imdb.pl

Replace the old script with the new one

 sudo cp imdb.pl /usr/share/mythtv/mythvideo/scripts/imdb.pl

Make the new script executable

 sudo chmod +x /usr/share/mythtv/mythvideo/scripts/imdb.pl

You should be all set after that.

Have updated link to older revision of imdb.pl, but this section still needs updating referencing the new equivalent Python script.

Custom Movie Artwork

MythVideo looks for artwork downloaded from IMDB in ~/.mythtv/MythVideo. You can put custom artwork here and then in Video Manager->Edit Metadata->Cover Art you can select your custom art from the dialog box.

Playing Videos

To play videos go to the Myth Mainpage->Media Library->Watch Videos screen.

The default view is the Folder View. This view can be changed via the on screen menu by pressing the menu button.

Selecting a video will bring up its detailed information. Selecting a second time will launch the video.


Media Shares

Mediashares gives a simple walk through of how to export your media directory so its accessible from your other remote Mythtv systems.