Archive for the ‘Frontend’ Category

Acer Aspire Revo - A cheap HD frontend?

Wednesday, August 12th, 2009

ord-ace-revo-150x150Was tipped off about this fantastic article from a recent Ubuntu Uk Podcast.  The hardware looks pretty interesting an could make a great HD frontend for MythTV with VDPAU enabled. There’s a good post about trying VDPAU in MythBuntu on the forums but I haven’t had a chance to try it yet as I don’t have one of the supported GPUs.

Anyway, just thought the article was so good it was worth pointing out for anyone that might be looking for a cheap, near silent HD frontend.

Update to Configuring Your MCE IR Remote

Tuesday, August 11th, 2009

Just made a quick update to the Configuring Your MCE IR Remote post. I have added in Audio Delay + and - to the mplayer lirc config. This allows you to control the audio / video sync with the Blue and Yellow buttons on your MCE remote. I had quite a few films that have the audio out of sync so this can now be sorted without reaching for the keyboard :)

Normalise Movie Volume

Friday, March 27th, 2009

I know DTS is all the rage at the moment but some DTS soundtracks have VERY LOUD LOUD BITS and very quiet quiet bits. This is great for the cinema or those people lucky enough to live in a detached house, but for my 2 bed flat it’s a bit over the top. To level things out mplayer can normalise your movie’s volume in realtime so that explosions are at the same volume as conversations. To enable normalisation add the following switch to the launch command for mplayer:

-af volnorm

So for example on your frontend navigate to “Utilities / Setup” -> “Setup” -> “Media Settings” -> “Video Settings” -> “Player Settings” and set the “Default Video Player” to:

mplayer -fs -zoom -quiet -vo xv -subfont-text-scale 3 -af volnorm -cache 8912 -cache-min 4 -lavdopts threads=2:fast:skiploopfilter=all -sws 0 %s

You may find it easier to connect to the mythconverg database and set the VideoDefaultPlayer to the value above for the host machine.

Automatically Convert Radio Shows To MP3 Format

Sunday, February 15th, 2009

It’s great to be able to record radio as well as TV channels using MythTV but to listen to them on an MP3 player they need to be transcoded to MP3 format. The process can be completely automated by setting up a User Job which runs after the show has recorded.

There are four main steps needed to get this going:

1. Install FFmpeg with MP3 encoding support
There’s a great guide for installing FFmpeg with MP3 encoding support here. Just follow it through making sure you use the suggested –enable-libmp3lame switch when running ./configure in step 5.

2. Install libid3-3.8.3-dev for automated ID3 tagging
This library will allow the MP3 encoding script to place ID3 meta tags into the resulting MP3.  Info like artist, song and year is set based on the show you are recording.

sudo apt-get install libid3-3.8.3-dev

3. Setup conversion script and MythTV User Job
The script below is the one that is executed by the User Job when the show finishes recording. It is based on this script from the MythTV Wiki but I’ve modified it to work with the latest version of FFmpeg and tag and name the resulting MP3 in my preferred format.

#!/bin/bash
 
###########
#
# Suggested execution format in the job settings for the backend (in general of the backend setup)
# Remember to allow the job to run in the backend general settings too :)
#
# autoaudio.sh %FILE% %STARTTIMEISO% "%TITLE%"
#
###########
 
OUTPUTDIR="/media/recordedtv/transcoded"
INPUTDIR="/media/recordedtv"
INFILE=$1
ISODATE=`date +%F`
PROGTITLE=$3
STARTDATE=${2:0:10}
 
# Split
###########
OUTFILE="$OUTPUTDIR/$PROGTITLE - $STARTDATE.mp3"
 
#transcode mp2 audio to mp3
ffmpeg -i "$INPUTDIR/$INFILE" -acodec libmp3lame -ab 192k -ar 44100 -f mp3 "$OUTFILE"
 
# Tag
##########
YEAR=`date +%Y`
id3tag --artist="$PROGTITLE" --song="$PROGTITLE - $STARTDATE" --comment="" -y$YEAR -A"Radio" "$OUTFILE"

Copy the script above and put it in a new file in your home directory called autoaudio.sh. For me this was /home/colin/autoaudio.sh. Change the “OUTPUTDIR” and “INPUTDIR” paths to match your setup. “OUTPUTDIR” will be where the MP3 files are created and “INPUTDIR” should be the path to the mpg files of your recorded shows.

Remember to make the script executable.

chmod 777 autoaudio.sh

Also, make sure the MythTV user can write to the output path.

4. Setup the user job
Go into the mythbackend setup and from the menu choose “General” and go to the last screen in this section titled “Job Queue (Job Commands)”. Enter a new job with the description of “Convert to MP3″ then enter the command as below changing the path to the location of your autoaudio.sh file. For me this is

/home/colin/autoaudio.sh %FILE% %STARTTIMEISO% "%TITLE%"

Choose “Finish” so you are back at the mythbackend main menu. Now we need to allow the job to run, so go back into “General” and scroll through to the screen titled “Job Queue (Backend-Specific)”. Tick the box for “Allow Convert to MP3 jobs”. Click “Next” and “Finish” until you are back to the main menu.

All Done
That’s it, you now have a user job which will convert shows to MP3, let’s check it works. I use MythWeb to manage things most of the time. In MythWeb, go to “Recorded Programs”, Click on a show title, then under “Queue a job” click the “Convert to MP3″ button. If all went well you should see an MP3 file created in the output directory you specified in autoaudio.sh. There may be a delay between clicking the button and an MP3 being created depending on how often your mythbackend is set to run user jobs. If nothing is created check the mythbackend logfile at /var/log/mythtv/mythbackend.log for errors.

Once it’s all working it can be activated on an existing recording schedule. In MythWeb, go to “Recording Schedules”, click on a schedule you have setup and look under “Advanced Options”. You should see a tick box for “Convert to MP3″. The show will now be converted to MP3 every time it records.

Quickly Sort Channels

Wednesday, February 11th, 2009

Something that’s not quite perfect in MythTV is sorting channels. You can move channels around one by one in the backend setup screens but this is slow and boring. A quicker way is to update the channel table in the mythconverg database on your backed. I had a search around and found this useful post on the Ubuntu forms but it was still a pain to have to adjust the SQL strings as they were.  My solution is to put the SQL into to a spreadsheet (attached below):

Channel Order Helper Spreadsheet

Obviously your channel listing is going do be different to mine so I suggest you do the following:

  1. Download the spreadsheet
  2. Get your existing channel names by running:
    SELECT DISTINCT name FROM channel ORDER BY LPAD(channum, 3, 0) ASC;
  3. Paste them into column D in the spread sheet
  4. Re-arrange as required
  5. Select all the cells and copy into gedit or similar (removing any tabs)
  6. Run all statements agains your mythconverg database.

NB. This will update the channel numbers for all sources (you could always change the sql to include a “WHERE sourceid = 1″ clause or simialr. Also, make sure that your frontend is set to sort by “Channel Number” in “Utilities/Setup” -> “Setup” -> “TV” -> “Settings” -> “General”

Play 720p HD Content Over Wireless & Make The Subtitle Size Sensible

Monday, February 9th, 2009

This one drove me nuts for a while, watching 720p content over 54Mbit/s wi-fi should work fine but with the “out of the box” settings HD moves were stuttering terribly for me.

As an additional niggle, embedded subtitles were appearing but they were enormous.

By default MythTV uses mplayer for mkv, avi and mpeg files. To resolve the stutter and subtitle issue open the MythTV frontend and go to “Utilities / Setup” -> “Setup” -> “Media Settings” -> “Video Settings” -> “Player Settings” and set the “Default Video Player” to:

mplayer -fs -zoom -quiet -vo xv -subfont-text-scale 3 -cache 8912 -cache-min 4 -lavdopts threads=2:fast:skiploopfilter=all -sws 0 %s

You may find it easier to connect to the mythconverg database and set the VideoDefaultPlayer to the value above for the host machine on wireless.

Configuring Your MCE IR Remote

Monday, February 9th, 2009

You can use the keyboard to control absouletly everything in MythTV but it’s not that practical once the lights are out and you’re mid movie. So one of the first things I was looking to do is get my Microsoft MCE remote working just the way I wanted.

For some background info you might want to check out the MCE Remote section of the MythTV wiki here.

MythTV does a pretty good job of setting up some defaults for the buttons but, if like me you’ve come from a Windows MCE system you may fine the lirc config files and associated script below useful.

These configs do four things above the functionality MythTV provides out of the box:

  1. Start / Restart mythfrontend when “the big green button” is pressed (handy if the frontend ever misbehaves)
  2. Cycle through subtitles when watching TV or movies in mplayer
  3. Make the Red button behave as expected for interactive TV. Green, Yellow, Blue and Teletext also act as they should.
  4. Make other buttons behave as a Windows MCE user would expect.

Here’s how all the buttons will function once everything is set up:

MCE Remote Mappings

MCE Remote Mappings


Girlfriend proof it

A small tip which helps with the gf factor is removing the exit and shutdown menu when the back button is pressed from the main menu. To do this, in the frontend go to “Utilities / Setup” -> “Setup” -> “General”. Go to the fourth screen with the title of  “General” and change the “System Exit Key” to “No exit key”. You can always exit the frontend with “alt F4″ if you need to.

Bash script to start / restart the frontend

The first thing to do is setup the bash script which will start or restart the MythTV frontend application when the big green button on your remote is pressed. Copy the script below and put it in a new file in your home directory.  I put mine in ~/mythtv/runmyth

#!/bin/sh
RUNNING=0;
 
for x in `ps -C mythfrontend.re | grep -v PID` end; do
    test $x != 'mythfrontend.re' && continue
    RUNNING=1;
done
 
if [ $RUNNING = 1 ]; then
  #kill the process
   kill -9 `ps -aef | grep 'mythfrontend.re' | grep -v grep | awk '{print $2}'`
  #start it up again
  `mythfrontend &`
else
  `mythfrontend &`
fi

Don’t forget to make it executable

chmod 777 runmyth

lirc config files
Now that’s out the way here follows the lirc files for MythTV and mplayer. They should go into ~/.lirc/mythtv and ~/.lirc/mplayer respectively. Make sure the runmyth script path is defined correctly on line four of the mythtv lirc file.

mythtv

begin
    prog = irexec
    button = Home
    config = /home/colin/mythtv/runmyth &;
end
 
begin
    remote = mceusb
    prog = mythtv
    button = LiveTV
    config = %
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = RecTV
    config = ;
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = DVD
    config = m
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Red
    config = F2
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Green
    config = F3
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Yellow
    config = F4
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Blue
    config = F5
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Teletext
    config = F6
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Clear
    config = w
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Star
    config = T
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Record
    config = R
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Seven
    config = 7
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Right
    config = Right
    repeat = 3
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Mute
    config = |
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Skip
    config = Right
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = One
    config = 1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Down
    config = Down
    repeat = 3
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Zero
    config = 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Replay
    config = Left
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Pause
    config = P
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Six
    config = 6
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Two
    config = 2
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = ChanDown
    config = Down
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = ChanUp
    config = Up
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Rewind
    config = <
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Forward
    config = >
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Play
    config = P
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = VolDown
    config = [
    repeat = 1
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Stop
    config = Escape
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Back
    config = Escape
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = VolUp
    config = ]
    repeat = 1
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Five
    config = 5
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = More
    config = I
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Four
    config = 4
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = OK
    config = Return
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Up
    config = Up
    repeat = 3
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Nine
    config = 9
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Three
    config = 3
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Enter
    config = Enter
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Eight
    config = 8
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Guide
    config = S
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mythtv
    button = Left
    config = Left
    repeat = 3
    delay = 0
end

mplayer

begin
    remote = mceusb
    prog = mplayer
    button = Play
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Star
    config = sub_select
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Blue
    config = audio_delay 0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Yellow
    config = audio_delay -0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = ChanDown
    config = panscan -0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = ChanUp
    config = panscan +0.1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Pause
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = OK
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Power
    config = quit
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Mute
    config = mute
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = VolDown
    config = volume -1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Skip
    config = seek +15 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Enter
    config = pause
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Stop
    config = quit
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Up
    config = seek +60 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = VolUp
    config = volume +1
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Down
    config = seek -60 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Replay
    config = seek -15 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Right
    config = seek +6 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Rewind
    config = seek -30 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Forward
    config = seek +30 0
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Home
    config = vo_fullscreen
    repeat = 0
    delay = 0
end
 
begin
    remote = mceusb
    prog = mplayer
    button = Left
    config = seek -6 0
    repeat = 0
    delay = 0
end