SI-05: HOWTO: Personal Video Recorder
Software Needed:
For watching and recording TV: Freevo
For grabbing TV guide listings: XMLTV
For video-editing: GOPchop and mencoder
Money
If you are like me and have an electricity bill going through the roof you'll be glad to find out that you can save money by doing away with your VCR (and when you don't mind a small screen even with your TV
Freevo
For watching and recording TV I use Freevo. It's in 'Contrib' so installing is 'urpmi freevo'. That will take care of all the dependancies.
Ugly hack:
The Freevo version in 'Contrib' is 1.4.1-12mdk and I couldn't get the recording to work. (I use a Hauppauge WinTV PVR 250 and the 'ivtv' driver). However later versions from CVS and the 1.5.0-pre1 worked fine (I haven't used 1.5.0-rc1). So if you use the ivtv driver I suggest you use the freevo 1.5.0 series.
-Just leave the 1.4.1 installation in place and download freevo 1.5.0.
-Untar it and copy the Freevo folder to /usr/local/.
-Edit /etc/freevo/boot_config (FREEVO_HOME="/usr/local/freevo")
-To start the 'good' Freevo version you will have to give the complete path /usr/local/freevo/freevo.
The 'local_conf.py':
This file in you $HOME/.freevo folder contains all the settings and you will have to edit it to get freevo working. This is not easy :(. It took me quite awhile to understand what it was all about so I sugest you take your time with it. I'll post below some of my settings as a pointer, but it will still be difficult.
QUOTE
CONFIG_VERSION = 5.06
# ======================================================================
# General freevo settings:
# ======================================================================
AUDIO_DEVICE = '/dev/dsp' # e.g.: /dev/dsp0, /dev/audio, /dev/alsa/?
# AUDIO_INPUT_DEVICE = '/dev/dsp1' # e.g.: /dev/dsp0, /dev/audio, /dev/alsa/?
# MAJOR_AUDIO_CTRL = 'VOL' # Freevo takes control over one audio ctrl
# # 'VOL', 'PCM' 'OGAIN' etc.
CONTROL_ALL_AUDIO = 0 # Should Freevo take complete control of audio
MAX_VOLUME = 90 # Set what you want maximum volume level to be.
DEFAULT_VOLUME = 70 # Set default volume level.
TV_IN_VOLUME = 90 # Set this to your preferred level 0-100.
VCR_IN_VOLUME = 70 # If you use different input from TV
START_FULLSCREEN_X = 0 # Start in fullscreen mode if using x11 or xv.
CONFIRM_SHUTDOWN = 0 # ask before shutdow
MENU_ARROW_NAVIGATION = 0
# ======================================================================
# Plugins:
# ======================================================================
# Use this ivtv_record instead if you have an ivtv based card (PVR-250/350)
# and want freevo to do everthing for you. TV_SETTINGS must be set
# correctly. To use you need the following two lines in local_conf.py:
plugin.remove('tv.generic_record')
plugin_record = plugin.activate('tv.ivtv_record')
# ======================================================================
# General freevo settings:
# ======================================================================
AUDIO_DEVICE = '/dev/dsp' # e.g.: /dev/dsp0, /dev/audio, /dev/alsa/?
# AUDIO_INPUT_DEVICE = '/dev/dsp1' # e.g.: /dev/dsp0, /dev/audio, /dev/alsa/?
# MAJOR_AUDIO_CTRL = 'VOL' # Freevo takes control over one audio ctrl
# # 'VOL', 'PCM' 'OGAIN' etc.
CONTROL_ALL_AUDIO = 0 # Should Freevo take complete control of audio
MAX_VOLUME = 90 # Set what you want maximum volume level to be.
DEFAULT_VOLUME = 70 # Set default volume level.
TV_IN_VOLUME = 90 # Set this to your preferred level 0-100.
VCR_IN_VOLUME = 70 # If you use different input from TV
START_FULLSCREEN_X = 0 # Start in fullscreen mode if using x11 or xv.
CONFIRM_SHUTDOWN = 0 # ask before shutdow
MENU_ARROW_NAVIGATION = 0
# ======================================================================
# Plugins:
# ======================================================================
# Use this ivtv_record instead if you have an ivtv based card (PVR-250/350)
# and want freevo to do everthing for you. TV_SETTINGS must be set
# correctly. To use you need the following two lines in local_conf.py:
plugin.remove('tv.generic_record')
plugin_record = plugin.activate('tv.ivtv_record')
QUOTE
MPLAYER_ARGS = { 'ivtv' : '-cache 5000'}
QUOTE
TV_SETTINGS = 'pal television europe-west /dev/video0'
TV_VCR_SETTINGS = 'pal television europe-west /dev/video0'
# if using the persitant record_server
TV_RECORD_SCHEDULE = '%s/record_schedule.xml' % FREEVO_CACHEDIR
TV_RECORD_SERVER_IP = 'localhost'
TV_RECORD_SERVER_PORT = XXXXX
# Settings for ivtv based cards such as the WinTV PVR-250/350.
#
# XXX TODO: Add descriptions and valid settings for each option.
# bitrate in bps
# stream type
# Options are: 0 (mpeg2_ps), 1 (mpeg2_ts), 2 (mpeg1), 3 (mpeg2_pes_av),
# 5 (mpeg2_pes_v), 7 (mpeg2_pes_a), 10 (dvd)
TV_IVTV_OPTIONS = {
# 'input' : 4,
'resolution' : '720x576',
'aspect' : 2,
'audio_bitmask' : 233,
'bframes' : 3,
'bitrate_mode' : 1,
'bitrate' : 4000000,
'bitrate_peak' : 4000000,
'dnr_mode' : 0,
'dnr_spatial' : 0,
'dnr_temporal' : 0,
'dnr_type' : 0,
'framerate' : 0,
'framespergop' : 15,
'gop_closure' : 1,
'pulldown' : 0,
'stream_type' : 10,
}
VIDEO_GROUPS = [
VideoGroup(vdev='/dev/video0',
adev='/dev/dsp',
input_type='tuner',
input_num=4,
tuner_norm='PAL',
tuner_chanlist='europe-west',
tuner_type='internal',
desc='TV kaart',
group_type='ivtv',
recordable='True'),
]
# FREQUENCY_TABLE - This is only used when Freevo changes the channel natively.
# This is only the case if you are using V4L2 and any of the following plugins:
# timeshift, ivtv_record, ivtv_basic_tv.
# For the standard frequancy tables see src/tv/freq.py. To add your own just
# replace tuner_id in the following example with a valid tuner id (ie: '5' or
# 'BBC1') and a frequency in KHz. You may have as many entries as you like,
# anything here will simply override a coresponding entry in your standard
# frequency table and you can also have entries here that are not present i
# there.
FREQUENCY_TABLE = {
'11-' : 216000,
'6+' : 184000,
'7+' : 192000,
}
#
# The TV_CHANNELS-list can look like this:
#
TV_CHANNELS = [('1.tvgids.nl', 'Nederland 1', '11-'),
('2.tvgids.nl', 'Nederland 2', '6+'),
('3.tvgids.nl', 'Nederland 3', '7+'),
('4.tvgids.nl', 'RTL 4', '12-'),
TV_VCR_SETTINGS = 'pal television europe-west /dev/video0'
# if using the persitant record_server
TV_RECORD_SCHEDULE = '%s/record_schedule.xml' % FREEVO_CACHEDIR
TV_RECORD_SERVER_IP = 'localhost'
TV_RECORD_SERVER_PORT = XXXXX
# Settings for ivtv based cards such as the WinTV PVR-250/350.
#
# XXX TODO: Add descriptions and valid settings for each option.
# bitrate in bps
# stream type
# Options are: 0 (mpeg2_ps), 1 (mpeg2_ts), 2 (mpeg1), 3 (mpeg2_pes_av),
# 5 (mpeg2_pes_v), 7 (mpeg2_pes_a), 10 (dvd)
TV_IVTV_OPTIONS = {
# 'input' : 4,
'resolution' : '720x576',
'aspect' : 2,
'audio_bitmask' : 233,
'bframes' : 3,
'bitrate_mode' : 1,
'bitrate' : 4000000,
'bitrate_peak' : 4000000,
'dnr_mode' : 0,
'dnr_spatial' : 0,
'dnr_temporal' : 0,
'dnr_type' : 0,
'framerate' : 0,
'framespergop' : 15,
'gop_closure' : 1,
'pulldown' : 0,
'stream_type' : 10,
}
VIDEO_GROUPS = [
VideoGroup(vdev='/dev/video0',
adev='/dev/dsp',
input_type='tuner',
input_num=4,
tuner_norm='PAL',
tuner_chanlist='europe-west',
tuner_type='internal',
desc='TV kaart',
group_type='ivtv',
recordable='True'),
]
# FREQUENCY_TABLE - This is only used when Freevo changes the channel natively.
# This is only the case if you are using V4L2 and any of the following plugins:
# timeshift, ivtv_record, ivtv_basic_tv.
# For the standard frequancy tables see src/tv/freq.py. To add your own just
# replace tuner_id in the following example with a valid tuner id (ie: '5' or
# 'BBC1') and a frequency in KHz. You may have as many entries as you like,
# anything here will simply override a coresponding entry in your standard
# frequency table and you can also have entries here that are not present i
# there.
FREQUENCY_TABLE = {
'11-' : 216000,
'6+' : 184000,
'7+' : 192000,
}
#
# The TV_CHANNELS-list can look like this:
#
TV_CHANNELS = [('1.tvgids.nl', 'Nederland 1', '11-'),
('2.tvgids.nl', 'Nederland 2', '6+'),
('3.tvgids.nl', 'Nederland 3', '7+'),
('4.tvgids.nl', 'RTL 4', '12-'),
These quotes from my local_conf.pyare only a help . Best is to start Freevo from a terminal the first few times and watch the error messages you get. These can help you find a solution more easily.
The Freevo recordserver:
This is a service that is needed to start and end a recording.You can find it in the MCC. However when you start it from there it won't work. (It's the 1.4.1 version). It must be started manually. Just like Freevo, start it the first time from a terminal as root (/usr/local/freevo/freevo recordserver).When it works use 'Alt-F2' (as root).
Stability:
I have the recordserver on 24/7 now for more then 2 weeks without problems. The same goes for Freevo. It's on one of my 4 desktops and I only shut it down when I exit X.
XMLTV
To get tv listings you need a grabber. Add Thac's RPM's as one of you repositories and do 'urpmi XMLTV'.
To use it open a terminal get the grabber for your country:tv_grab_XX --output /tmp/TV.xml --days X. The --slow option will give you more information (what a movie is about etc), but it's... slow
Freevo expects the TV.xml in /tmp
Video editing
There isn't a really good video editor for Linux yet. KdenLive and Avidemux don't work with MPEG2 files and Cinelerra is unstable. The only program usuable for me is GOPchop. I use it to cut commercials and bits at the beginning and the end of a program. There is no RPM that i'm aware of so you have to compile it yourself (./configure-make-make install straightforward stuff)
For compressing a file there is mencoder (urpmi mencoder). The commands I use are :
QUOTE
mencoder *.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o outputfile.avi
mencoder *.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o outputfile.avi
.mencoder *.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o outputfile.avi
But if you're making a DVD use of course the MPEG2 file.
Conclusion
It is possible to use Mandrake as a PVR. With the steps I have described you can turn your computer in a television and VCR. I haven't gone into the use of Freevo but it has many nifty features. One of the things I use most is listing a program as 'favorite'. That means Freevo will record the show every time it's on without me having to do anything. The only thing I need now is more time to watch all my recordings