freevo

My HTPC now runs Freevo, and pretty much works. I'm quite proud of this. Here's some tips.

First of all, you need a TV card. One that works. My advice is to buy a cheap Hauppauge PCI card, WinTV branded. Not the PVR series, one of the ones with a Brooktree chip. These will work as soon as you plug them in, with the bttv module; plug 'em in, reboot, check bttv is loaded (on recent MDK / MDV, it should be), run tvtime and you'll probably get a signal. Until you can get a signal out of tvtime, don't bother doing anything else.

Install freevo. It's in contrib for all recent MDV releases. Now, you need to set it up. You do this by editing /etc/freevo/local.conf.py . This is a python file, so you have to be careful editing it; one apostrophe out of place and Freevo won't just ignore it, it won't run. Here's what to do.

Set AUDIO_INPUT_DEVICE to your...audio input device. If you just have a soundcard and you're running a little 3.5mm cable from the line-out on the TV card to the line-in on your soundcard, which is what I'm doing, this will be your soundcard, likely /dev/dsp . You can try using the btaudio or snd-bt8x8 modules to get sound out of the TV tuner directly, but it never worked for me.

Uncomment the line:

plugin.activate('tv.tvtime')

tvtime is a great TV viewing app, better than mplayer IMHO. Nice de-interlacing options and image control.

Unless you want to bother signing up for an Amazon.com associate developer account (or have one already), comment out this line to stop freevo moaning at you on the console:

plugin.activate('audio.coversearch')

I also commented:

plugin.activate('audio.cdbackup')

As I rip my CDs on another machine. If you want it, leave it active and configure it. I disabled the USB plugins stuff, too, as I'm never going to use it and it simplified things.

Set VIDEO_ITEMS to the directory containing your video files. For me, the line looks like this:

VIDEO_ITEMS = [ ('/data/video') ]

I also changed the following setting:

VIDEO_PREFERED_PLAYER = 'xine'

Using mplayer, for some reason, causes freevo to fail to read some of my .avis. Xine is also better at DVDs than mplayer, though I didn't test which one freevo uses for DVDs if you leave the setting at mplayer (it may still use xine, I suppose).

Set AUDIO_ITEMS to the directory containing your music and IMAGE_ITEMS to the directory containing your pictures (if you have any you want freevo to deal with), as with VIDEO_ITEMS for video.

Set TV_RECORD_DIR to the directory you want TV to be recorded to. Vitally, this directory must be readable and writable by the user 'freevo' . Example:

TV_RECORD_DIR = '/data/video/freevo'

I set these two:

TV_VIEW_SIZE = (640, 480) TV_REC_SIZE = (640, 480)

for higher quality. For reference, my Athlon XP 2500+, running at around 3000+ speed, ran about 50% CPU utilisation encoding with libavcodec, and runs about 75% encoding with xvid (see later for these options).

Now the biggie - the actual recording command, TV_VCR_CMD. I have this: VCR_CMD = (CONF.mencoder + ' ' + 'tv:// ' + '-tv driver=v4l2:input=0' + ':norm=NTSC' + ':channel=%(channel)s' + ':chanlist=us-cable' + ':width=%d:height=%d' % (TV_REC_SIZE[0], TV_REC_SIZE[1]) + ':brightness=-16' + ':contrast=-20' + ':saturation=100' + ':outfmt=%s' % TV_REC_OUTFMT + ':adevice=/dev/dsp' + ':audiorate=44100 ' + '-ovc xvid -xvidencopts ' + 'bitrate=1200 ' + '-oac mp3lame -lameopts ' + 'br=128:cbr:mode=3 ' + '-ffourcc divx ' + '-endpos %(seconds)s ' + '-o %(filename)s')

TV driver, norm and channel list may vary depending on whether your TV card goes through v4l or v4l2, whether you're in an NTSC or PAL country, and what country you're in, obviously. Brightness, contrast and saturation you should fiddle with for best quality; you can play with them in tvtime first then translate the settings to mencoder. tvtime uses a 0-100 scale, mencoder uses -100 to 100, you do the math. The settings above work for me, but may well be totally different for you. The other settings tell it to use xvid video encoding and lame MP3 encoding. The default, libavcodec, is less CPU intensive than xvid, but in my opinion gives fairly poor video quality that I didn't consider sufficient (it looked worse than a VCR). For lame output, you will need the lame encoder. Since I live in a country where software patents are not valid, I can safely use the mplayer package from PLF, which supports lame encoding. If you live in a country where software patents are enforced, you are not legally allowed to install this package.

What this command does is produce an mencoder command, so you can easily test your settings just by logically extracting them to an mencoder command. To make things easier, the recordserver logs the command it runs in /tmp/freevo , so you can see what command was used and try running it in a console if something goes wrong, for testing purposes. You have to be very careful with your ' , : and spaces at the ends of lines.

I also have VCR_PRE_REC and VCR_POST_REC set:

VCR_PRE_REC = ('/usr/local/freevo/vcr_pre_rec.sh') VCR_POST_REC = ('/usr/local/freevo/vcr_post_rec.sh')

These scripts call amixer to set up the line-in recording levels. They look like this:

!/bin/bash

VCR_PRE_REC script to set the line in volume and mute the sound so you don't hear it wehen recording

AMIXER=/usr/bin/amixer # path to amixer

$AMIXER -q sset Line 71% mute $AMIXER -q sset Capture 53% $AMIXER -q cset numid=28 4 # select capture source, 28 is capture source control, 1 = CD, 3 =aux 4 = line $AMIXER -q cset numid=29 1 # set capture source switch to 1 (= on)

!/bin/bash

VCR_POST_REC script : unmute cd again to hear sound when using watching tv after recording

AMIXER=/usr/bin/amixer # path to amixer

$AMIXER -q sset Line 71% unmute # unmute cd again to hear sound when using watching tv after recording

amixer is somewhat scary at first. The first two controls in pre_rec just set the volume levels for Line and Capture; they should work on most cards. The last two will be more card specific. To find out which numbers to use on your card, run 'amixer controls', and it will list all the available ones. Find the one called 'Capture Switch' and use its number instead of 29 above. Then find the one called 'Capture Source' and use its number instead of 28 above. Then run 'amixer cget numid=28' (or whatever number is right on your system) to see the available values. Check that 4 is the correct value for Line on your card. If a different number is labelled as 'Line', replace 4 in the pre_rec script above with that number. It's a very good idea to have these scripts rather than just rely on setting the settings manually once and having them stay, as I've found many apps are rather cavalier with the ALSA mixer and will reset values they shouldn't touch. After I run totem or tvtime or some other audio app, I'll often find my capture volume back at zero, which would result in silent TV recordings without these scripts.

For the TV_CHANNELS section, you can run 'freevo tvgrab --query' in a console - once you have xmltv properly configured - to generate a sample configuration. The generated one worked for me.

Set XMLTV_GRABBER to the correct xmltv grabber for your region. For North America, this will be:

XMLTV_GRABBER = 'tv_grab_na_dd'

You need to create a DataDirect account and then configure xmltv to get TV guide listings. xmltv has documentation on doing this.

Comments

No comments.