Linux Media

From JimboWiki
Jump to: navigation, search

This is not meant to be a complete walk-through for anything - there's plenty of those and software changes way too fast for me to keep up. Here you will find a simple summary of some important items to know about when setting up high-grade home media stuff in Linux.

Media Platforms


If you're building a home media server, you're going to want to look at MythTV. It's pretty sweet and is fairly easy to set up.

MythTV runs on just about anything Linux with a proper display. One of the most commonly referenced set up guides is Jarod's Guide, which is usually up to date, and seems to cover most of the important setup work to get you going. You can also get MythTV as part of a ready-made Linux distribution. The most popular ones are the Ubuntu based MythUbuntu and the Fedora based MythDora. These are great alternatives for people who want to skip the "follow this process" setup work.

MythTV runs in two pieces - a daemon that runs in the background and a front-end that can be run on an X display. This means you can still use your MythTV system as your primary computer if you like. This can be applied the other way - allowing you to turn your primary computer into a media system quite easily.

Major MythTV features include:

  • Ability to record TV
  • Ability to skip commercials during recorded TV playback
  • Ability to catalog and play music (MythMusic plugin)
  • Ability to catalog and view movies in any file format supported by Mplayer (MythVideo plug-in)
  • Ability to rip and auto transcode DVDs in the background (MythTranscode plug-in)
  • Ability to create DVDs from media on the system (MythArchive plug-in)
  • Remote control and TV friendly interface
  • Load balanced TV recording across multiple computers running MythTV
  • Web interface (MythWeb plug-in) to manage MythTV configuration and TV recording schedule

MythTV does not help you much in configuring your hardware - see the sections below for help with special tasks associated with media viewing.


LinuxMCE is a bit more hard core than MythTV. MythTV has some networking features - like being able to load-balance TV recording, and allowing you to view recordings on multiple networked computers - but LinuxMCE takes this to a whole new level. LinuxMCE is made to be run across multiple systems on the network, sharing media and responsibilities as needed. It's also does a lot more than MythTV is capable.

LinuxMCE runs on top of Kubuntu, and takes over just about all of the configuration of the system. It runs MythTV in the background to deal with TV recording - becase Myth is damned good at that - but LMCE takes care of all the rest on its own. LMCE does many things that MythTV does - like managing videos, recording and watching TV, and managing music. Unlike MythTV, where only TV shows are shared over the network to other media system, LMCE shares all the media between LMCE systems and maintains a UPnP media server for other devices. It also hunts down new media providing devices on your network and asks if you'd like to add their contents to the media library.

But media is just part of LMCE - it also has a set of whole-home automation features including:

  • The ability to control all your A/V equipment over IR, RS-232 (serial), or Ethernet
  • The ability to learn the IR codes of most devices
  • The ability to control the lighting (or anything plugged into the home's lighting control system)
  • The ability to control the home's climate system
  • The ability to control or act in place of the home's security system

On top of all that, LMCE manages the configuration of all the computers running LMCE with features like:

  • Directed setup wizard (with Video directions) to automatically configure the computer and extended LMCE system
    • This wizard configures all of the things described in the sections below automatically - saves so much time it's not even funny...
  • Web management system for configuration of the entire LMCE system (and in turn, computers running LMCE)
  • Easy creation and management of software RAID arrays (uses mdadm - simplifies this process to a few clicks)
  • Automatic setup of new LMCE machines (called Media Directors or Orbiters) by creating and maintaining a network boot image for each machine
  • Automatic setup of many devices connected to the system such as IR transceivers and new storage devices

So it's a massively expandable, home controlling, media viewing monster. But wait, there's more! Check out the LMCE website and see some demos. (Disclaimer: The demo video is a little over-simplified - there's actually quite a bit of setup to get things running that smoothly. Though I'd say it's not an excessive amount of setup, it is completely left out of the video. Also notice that the hardware selected for the demo plays a large role in the functionality and usability of the system shown - you might want something different, which may be more difficult to get working or may not work as well.)

Of course, there are some (very few) downfalls.

  • I HATE Kubuntu, mostly because it runs KDE, also because it just sucks. Because of this, I could never use a LinuxMCE system as a normal computer without dual booting it. It is possible to use an LMCE system as a regular computer - there's a button in the LMCE interface to break out to Kubuntu desktop.
  • The hardware requirements are a bit more strict than with MythTV. For instance, plain old serial IR transceivers don't cut it in LMCE land - you've got to go buy the USB-UIRT - which is a great product, by the way, and saves a lot of frustration.
  • Because the system is so huge, there are some minor usability issues, though most can be overcome.
  • Because the system is so awesome, and connects with so many things, you will want to buy a lot of new toys - then you'll be broke, and your significant other may get angry about that.


Important ALSA Commands

I use ALSA for sound, and so do most people, so here's some important commands that will help get you going with ALSA:

  • alsamixer - a console mixer for all devices
  • alsamixergui - GUI version of alsamixer
  • alsactl - learn about installed ALSA devices
  • aplay - play waves and whatnot
  • cat /proc/asound/devices - list all ALSA devices and see what they are for

Digital Sound

It's possible to have digital sound pass through the system directly to your receiver in AC3 or DTS format. To do this, you must:

  • have the proper cabling (digital coax, fiber optics, digital DIN)
  • have the proper sound card, which has a digital output connector and is NOT a USB device. (See the ALSA sound card compatibility matrix for more information.)
  • have a receiver with a digital decoder built in
  • have a digital source. Digital sources include (but are not limited to) DVDs, AC3 audio tracks, and AVIs with a52 audio streams (like what is created by MythTV if you rip a DVD).

To get digital audio pass-through to work, there are several things that need to be done:

  • Get ALSA up and running - hopefully this is the default for your distribution
  • Cable things properly - self explanatory...
  • Configure the ALSA Mixer (if needed)
    • The ALSA mixer does not only include volumes - it also has control switches for sound card features
    • One such feature is often a digital/analog switch, or a power switch for optical output
    • Look on forums with your specific card and ALSA version for proper mixer settings if you have trouble or weird noises
    • For Sound Blaster owners looking to use the "Digital DIN" output (like me):
      • Set "IEC985 Optical" to mute (off)
      • Set "IEC958 Optical Raw" to mute (off)
      • Set the "Analog/Digital output jack" to unmute (on)
      • You may notice 2 sets of surround volume controls - one controls volumes of digital signals, the other controls analog signals
      • Digital DIN will automatically switch between digital (AC3/DTS) signals and analog signals without reconfiguration of the receiver or ALSA output settings
      • You may also need to run iecset audio on to force the system to use the DIN output for all audio and to make sure things are sent digitally. This option may be reset at random points in time, so if things stop working try this first.
  • Configure your media player
    • mplayer
      • add the following command line argument to enable AC3 pass through: -ac hwac3,a52,
      • This will tell mplayer to:
        • hwac3 - first try to output an AC3 stream (try hwdts for DTS streams)
        • a52 - if that doesn't work (i.e. hardware problem or bad stream) then try decoding the AC3 stream using a52 codec
        • trailing comma - if that doesn't work (i.e. no AC3 stream found) fall back onto regular codecs
      • Some other command line arguments that may be interesting to you:
        • -a52drc 0 - turn off volume leveling (it is on by default)
        • -af-adv force=5 - attempt to use floating point precision when applying filters
        • There's a small encyclopedia worth of additional arguments in the mplayer man page.
    • MythTV
      • There is an option for AC3 pass through under Utilities/Setup --> Setup --> General -> 3rd or so page. I believe this only applies to DVDs.
      • To make it work for video files, edit the mplayer arguments under Utilities/Setup --> Setup --> Media Settings --> Video Settings --> Player Settings as described above.

Remote Control (LIRC)

You can probably Google up an install guide for your particular distribution without much effort.

Important Commands

Here's a quick summary of important commands. Look at their man pages for more detailed information on how to use them.

  • mode2 - Shows raw IR signals that the IR Receiver is seeing. This is useful to check to see if you're getting signals into the computer.
  • irrecord - Remote Recorder. Records the signals a remote sends and maps those raw signals to useful names, then creates a file properly formatted to be used as an lircd.conf file.
  • irw - Remote decoder. Shows the button names the IR Receiver is seeing. This is useful to check a newly configured remote control
  • lircd -n - LIRC Daemon, foreground. This runs the LIRC Daemon without forking off to the background, so you can see all the console messages. This is useful for figuring out why lircd keeps crashing.

Important Files

  • ~/.lircrc
    • Map LIRC commands to keystrokes depending on what application you're running
  • lircd.conf
    • Configure the LIRC daemon to do what it's supposed to
  • try this crazy thing:
    • Generates some files for you, and gives you the IR codes for many remotes


Try these commands:

  • mode2
    • Output the IR pulses LIRC sees to the console - good to check reception.
  • irw
    • Output the incoming commands LIRC sees to the console - good to check your remote configuration.
  • lircd -n
    • Runs LIRC daemon in foreground mode so you can see the error that is making it explode