Multiple BTTV TV Cards
This is what I did to add a secondary tuner for recording, keeping the main tuner free for live tv viewing. Someone that knows Freevo better than I do should probably write this part, but something better than nothing right? 4 hours experience with Freevo and counting (version 1.5.2).
In the local_conf.py file there are to variables VCR_CMD and VCR_AUDIO that tells mencoder everything it needs to know about recording by pulling together several of the variables defined earlier in the file, or in freevo.conf.
CONF.mencoder (freevo.conf) CONF.tv (freevo.conf) CONF.chanlist (freevo.conf) TV_DRIVER = 'v4l2' TV_DEVICE = '/dev/video0' TV_INPUT = '0' AUDIO_DEVICE = ='/dev/dsp'
What I did was create duplicates of these variables to reflect the hardware device I wanted to use for recording.
TV_DRIVER_2 = 'v4l2' TV_DEVICE_2 = '/dev/video1' TV_INPUT_2 = '0' AUDIO_DEVICE_2 = '/dev/dsp1'
The CONF.x variables I left alone, since they would be the same for each tuner.
After adding the variables, find the VCR_AUDIO variable and change AUDIO_DEVICE to AUDIO_DEVICE_2 to use the second sound source.
VCR_AUDIO = (':adevice=%s' % AUDIO_DEVICE_2 + ':audiorate=32000' + # 44100 for better sound ':forceaudio:forcechan=1:' + # Forced mono for bug in my driver 'buffersize=64') # 64MB capture buffer, change?
Now modify the VCR_CMD variable to use the _2 variables instead of the main. For my card I had to add the normid=1 part to select NTSC. See the mencoder pages for more info.
VCR_CMD = (CONF.mencoder + ' ' + 'tv:// ' + # New mplayer requires this. '-tv driver=%s:input=%d' % (TV_DRIVER_2, TV_INPUT_2) + ':norm=%s' % CONF.tv + ':normid=1' + # I had to add this to make it work for my card ':channel=%(channel)s' + # Filled in by Freevo ':chanlist=%s' % CONF.chanlist + ':width=%d:height=%d' % (TV_REC_SIZE, TV_REC_SIZE) + ':outfmt=%s' % TV_REC_OUTFMT + ':device=%s' % TV_DEVICE_2 + VCR_AUDIO + # set above ' -ovc lavc -lavcopts ' + # Mencoder lavcodec video codec 'vcodec=mpeg4' + # lavcodec mpeg-4 ':vbitrate=1200:' + # Change lower/higher, bitrate 'keyint=30 ' + # Keyframe every 10 secs, change? '-oac mp3lame -lameopts ' + # Use Lame for MP3 encoding, must be enabled in mencoder! 'br=128:cbr:mode=3 ' + # MP3 const. bitrate, 128 kbit/s '-ffourcc divx ' + # Force 'divx' ident, better compat. '-endpos %(seconds)s ' + # only mencoder uses this so do it here. '-o %(filename)s') # Filled in by Freevo
One catch to this is the need to adjust mixer levels on the second sound card manually. In my case this meant running
'alsamixer -c 1', setting the line-in volume up, muting it, and setting it for capture.
If it doesn't work for you, add a print line for the VCR_CMD "print VCR_CMD" to the end of local_conf.py for testing. Run freevo and make note of the output for VCR_CMD. Change '%(channel)s', %(seconds)s, and %(filename) to something appropriate(such as 3, 10, and test.avi) and try running the command manually to find the reason it isn't working.
Finally, the recordserver script puts a drop file to prevent live tv viewing / channel changes during record. I couldn't see a way to disable this with an option, so I did it by patching the recordserver.py file.
Locate the line:
tv_lock_file = config.FREEVO_CACHEDIR + '/record'
Change this line to:
tv_lock_file = config.FREEVO_CACHEDIR + '/record.tuner2'
If anyone else has a cleaner way to do this, for the love of god and all that is holy write it up and put it here!
Multiple IVTV Cards
I happen to have a pair of Hauppauge WinTV PVR 150 MCE cards in my system. I found that setting up multiple IVTV cards requires extra recording groups to be created and very little else. In local_conf.py, the suggested settings are:
VIDEO_GROUPS = [ # Use this group for watching tv VideoGroup(vdev=TV_VIEW_DEVICE, # In my case, /dev/video1 adev=TV_VEIW_AUDIO_DEVICE, # Set to None for Hauppauge PVR cards input_type='tuner', tuner_norm=CONF.tv, tuner_chanlist=CONF.chanlist, desc='Watching Video Group', group_type='ivtv', record_group=1), # Use this group for recording tv VideoGroup(vdev=TV_RECORD_DEVICE, # In my case, /dev/video0 adev=TV_RECORD_AUDIO_DEVICE, # Again, set to None for Hauppauge PVR cards input_type='tuner', tuner_norm=CONF.tv, tuner_chanlist=CONF.chanlist, desc='Recording Video Group', group_type='ivtv', record_group=None) ]
Most, if not all, of the Hauppauge PVR cards have additional inputs which can also be configured as viewable and recordable inputs. I got these working by setting up the following:
VIDEO_GROUPS = [ VideoGroup( vdev='/dev/video1', adev=None, input_type='tuner', input_num=0, tuner_norm='NTSC', tuner_chanlist='us-cable', desc='Local Cable', group_type='ivtv', record_group=1), VideoGroup( vdev='/dev/video0', adev=None, input_type='tuner', input_num=0, tuner_norm='NTSC', tuner_chanlist='us-cable', desc='Local Cable Recording', group_type='ivtv', record_group=None), VideoGroup( vdev='/dev/video1', # Composite input on /dev/video1 adev=None, # for viewing only. input_type='composite', input_num=2, tuner_type='external', desc='Composite Input', group_type='ivtv', record_group=3), VideoGroup( vdev='/dev/video0', # Composite input on /dev/video0 adev=None, # for recording only. input_type='composite', input_num=2, tuner_type='external', desc='Composite Input Recording', group_type='ivtv', record_group=None), VideoGroup( vdev='/dev/video1', # S-Video input on /dev/video1 adev=None, # for viewing only. input_type='svideo', input_num=1, tuner_type='external', desc='S-Video Input', group_type='ivtv', record_group=5), VideoGroup( vdev='/dev/video0', # S-Video input on /dev/video0 adev=None, # for recording only. input_type='svideo', input_num=1, tuner_type='external', desc='S-Video Input Recording', group_type='ivtv', record_group=None) ]
Because I use ivtv_record and ivtv_xine_tv, there isn't much else to configure.