Linux VDR Tips




Cutting Video for DVD


Really the best program for this is dvbcut. Tested with 0.5.4. If your recording is splitted in multiple files, join them before:

cat 001.vdr 002.vdr 003.vdr > joined.vdr

Then call

dvbcut joined.vdr

(or use 001.vdr if it was only one file). There are 2 sliders in dvbcut. A linear and a nonlinear. With the linear you can find a position nearby a cutting mark and with the nonlinear you can find the frame you want to cut. Set the start and stop marks and export the video. The resulting video has a .mpg extension and can be used with DVD burning tools.

Cutting Video for VDR and DVD (later or before)


Goal here is to get rid of Ads and things recorded before and after the movie you recorded. Just use the same way as described in the chapter before. But if you want to use the cutted video also for viewing with VDR the video has some format restrictions: The files cannt be larger than 2GB and the files have to be separated at a GOP (group of pictures. A special point in a mpeg file that is occurs every 12 frames or so). We also need a index file for VDR so that you can use fast forward.

So after creating the joined.mpg (or 001.mpg) delete the old files:

rm 00*.vdr index.vdr marks.vdr joined.vdr

Then create a index file and split the mpeg in vdr files:

genindex -r -i joined.mpg

The tool genindex can be downloaded here. Tested with 0.1.3.

Convert DVD compatible files for VDR


With disks that have > 1TB size the handling of DVDs is more and more uncomfortable. There are also some DVDs that cannot be played in a standard DVD player so some may want to convert them to a VDR file to play them using Linux VDR. Once you have a mpeg file coming from a DVD you can use genindex to make it to a VDR file. But if you use a full featured DVB Card, it may not be able to play AC3 sound. So if you hear no sound, you have to convert the sound before:
ffmpeg -y -i movie_ac3sound.mpg -vcodec copy -acodec mp2 -ab 256k -ar 48000 movie_mp2sound.mpg

Then go to your recordings directory and create directories:
mkdir -p moviename/2009-08-04.18.05.99.99.rec
Choose any date string you like. Move your movie file there and use genindex to create the vdr files:
mv movie_mp2sound.mpg moviename/2009-08-04.18.05.99.99.rec
cd moviename/2009-08-04.18.05.99.99.rec
genindex -r -i movie_mp2sound.mpg
You can remove the original file if all works. Restart vdr and enjoy.


Convert radio recordings to mp3


It took some time, but the solution is easy. Lame can read the files created by VDR and convert it to mp3 directly. You just have to rename the file to .mp2 or use -mp2input with lame. Example:

lame mp2input abr 192 001.vdr out.mp3

Ignore "bitstream problem: resyncing.." errors.
You could also use the ID3 tag options (-tt -ta ...) in lame together with the info.vdr file fo fill the tags.

budget_core buffer


If you get errors like:
saa7146 (0) vpeirq: used 1 times >80% of buffer (183112 bytes now)
It can be fixed by creating al file /etc/modprobe.d/budget_core with content:
options budget_core bufsize=1410

Opensuse 11.3 DVB-S2 with Hauppage Nova HD-S2


Firmware


I use 1.22.82.0. Howto copied from http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-4000#Firmware:

wget http://www.hauppauge.de/software/mce/88x_2_122_26109_WHQL.zip
unzip -jo 88x_2_122_26109_WHQL.zip Driver88/hcw88bda.sys
sudo dd if=hcw88bda.sys of=/lib/firmware/dvb-fe-cx24116-1.22.82.0.fw skip=75504 bs=1 count=32501 
sudo ln -s /lib/firmware/dvb-fe-cx24116-1.22.82.0.fw /lib/firmware/dvb-fe-cx24116.fw


I tried to get the newest firmware using hauppage drivers and this manual:
http://www.mythtvtalk.com/firmware-update-hauppauge-nova-hd-s2-hvr-4000-a-12058/#post49042:

unzip -jo 88x_2_126_28225_WHQL.zip Driver88/hcw88bda.sys
sudo dd if=hcw88bda.sys of=/lib/firmware/dvb-fe-cx24116-1.26.90.0.fw skip=105768 bs=1 count=32290 
sudo ln -s /lib/firmware/dvb-fe-cx24116-1.26.90.0.fw /lib/firmware/dvb-fe-cx24116.fw


(unverified for now)




Make it work: Use yast2


Let yast configure the tv card.

vdr 1.7.X


wget ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.16.tar.bz2
tar -xvjf vdr-1.7.16.tar.bz2
cd vdr-1.7.16

Now install missing development packets (you may need some more ... the libcap-devel is not findable with the repository)
wget http://download.opensuse.org/distribution/11.3/repo/oss/suse/x86_64/libcap-devel-2.16-9.1.x86_64.rpm
rpm -i libcap-devel-2.16-9.1.x86_64.rpm 
zypper in fontconfig-devel libjpeg-devel

make && make install


NOTE: another easier possibility is to use a repository like this here: http://download.opensuse.org/repositories/home:/balta3:/vdrdevel/openSUSE_11.3

Suse settings


I had Suses vdr installed and so i just modified the thing to work with the new vdr.

Modify /usr/sbin/runvdr. Change the line with VDR_BIN:
VDR_BIN="/usr/local/bin/vdr"


Suse uses /var/spool/video for recording, while vanilla vdr uses /video. You have to live with it or change it somewhere. VDR 1.7 uses another Port for SVDRP. You can set it back to old default 2001 in /etc/sysconfig/vdr.

Alternative


you can also modify the Make.config:

MANDIR   = /usr/man
BINDIR   = /usr/bin

LOCDIR   = ./locale
PLUGINDIR=  ./PLUGINS
PLUGINLIBDIR= /usr/lib64/vdr
VIDEODIR = /var/spool/video
CONFDIR  = $(VIDEODIR)


Problems


NOTE: see at the end of this section - it was a hardware problem!

At time of writing i see the oom-killer once a day. I think its a bug in the driver. The messages look like these:

Oct 17 11:23:34 willie kernel: [70536.998985] oom_kill_process: 3 callbacks suppressed
Oct 17 11:23:34 willie kernel: [70536.998989] cx88[0] dvb invoked oom-killer: gfp_mask=0xd4, order=0, oom_adj=0
Oct 17 11:23:34 willie kernel: [70536.998993] cx88[0] dvb cpuset=/ mems_allowed=0
Oct 17 11:23:34 willie kernel: [70536.998996] Pid: 21669, comm: cx88[0] dvb Not tainted 2.6.34.7-0.3-xen #1
Oct 17 11:23:34 willie kernel: [70536.998998] Call Trace:
Oct 17 11:23:34 willie kernel: [70536.999011]  [<ffffffff80009646>] dump_trace+0x76/0x1a0
Oct 17 11:23:34 willie kernel: [70536.999017]  [<ffffffff8040a79b>] dump_stack+0x69/0x6f
Oct 17 11:23:34 willie kernel: [70536.999022]  [<ffffffff800d0e9f>] dump_header+0x8f/0xf0
Oct 17 11:23:34 willie kernel: [70536.999027]  [<ffffffff800d0f91>] oom_kill_process+0x91/0x190
Oct 17 11:23:34 willie kernel: [70536.999031]  [<ffffffff800d14c1>] __out_of_memory+0x41/0xb0
Oct 17 11:23:34 willie kernel: [70536.999035]  [<ffffffff800d1872>] out_of_memory+0x62/0xe0
Oct 17 11:23:34 willie kernel: [70536.999039]  [<ffffffff800d4895>] __alloc_pages_nodemask+0x615/0x630
Oct 17 11:23:34 willie kernel: [70536.999044]  [<ffffffff800fdde1>] __vmalloc_area_node+0xf1/0x210
Oct 17 11:23:34 willie kernel: [70536.999047]  [<ffffffff800fe028>] vmalloc_32+0x28/0x30
Oct 17 11:23:34 willie kernel: [70536.999068]  [<ffffffffa048dc62>] videobuf_dma_init_kernel+0x42/0xe0 [videobuf_dma_sg]
Oct 17 11:23:34 willie kernel: [70536.999080]  [<ffffffffa048e340>] __videobuf_iolock+0x110/0x140 [videobuf_dma_sg]
Oct 17 11:23:34 willie kernel: [70536.999088]  [<ffffffffa05e20fa>] cx8802_buf_prepare+0xca/0x150 [cx8802]
Oct 17 11:23:34 willie kernel: [70536.999097]  [<ffffffffa0482bab>] __videobuf_read_start+0xdb/0x170 [videobuf_core]
Oct 17 11:23:34 willie kernel: [70536.999103]  [<ffffffffa048307e>] videobuf_read_start+0x1e/0x40 [videobuf_core]
Oct 17 11:23:34 willie kernel: [70536.999109]  [<ffffffffa06ad855>] videobuf_dvb_thread+0x45/0x1d4 [videobuf_dvb]
Oct 17 11:23:34 willie kernel: [70536.999116]  [<ffffffff80063f2e>] kthread+0x8e/0xa0
Oct 17 11:23:34 willie kernel: [70536.999122]  [<ffffffff80007e04>] kernel_thread_helper+0x4/0x10
Oct 17 11:23:34 willie kernel: [70536.999125] Mem-Info:
Oct 17 11:23:34 willie kernel: [70536.999127] DMA per-cpu:
Oct 17 11:23:34 willie kernel: [70536.999129] CPU    0: hi:    0, btch:   1 usd:   0
Oct 17 11:23:34 willie kernel: [70536.999130] CPU    1: hi:    0, btch:   1 usd:   0
Oct 17 11:23:34 willie kernel: [70536.999132] DMA32 per-cpu:
Oct 17 11:23:34 willie kernel: [70536.999133] CPU    0: hi:  155, btch:  38 usd: 154
Oct 17 11:23:34 willie kernel: [70536.999135] CPU    1: hi:  155, btch:  38 usd: 139
Oct 17 11:23:34 willie kernel: [70536.999137] Normal per-cpu:
Oct 17 11:23:34 willie kernel: [70536.999138] CPU    0: hi:  155, btch:  38 usd: 149
Oct 17 11:23:34 willie kernel: [70536.999140] CPU    1: hi:  155, btch:  38 usd:  31
Oct 17 11:23:34 willie kernel: [70536.999144] active_anon:39651 inactive_anon:31739 isolated_anon:0
Oct 17 11:23:34 willie kernel: [70536.999144]  active_file:4724 inactive_file:12849 isolated_file:0
Oct 17 11:23:34 willie kernel: [70536.999145]  unevictable:5 dirty:69 writeback:0 unstable:0
Oct 17 11:23:34 willie kernel: [70536.999146]  free:24186 slab_reclaimable:2827 slab_unreclaimable:10120
...


TeVii S470


Tried with another DBV-S2 card: I purchased a TeVii S470 DVB-S2 PCIe Card which has many advantages:
  • PCIe - newer technology
  • Power saving functions (not verified if they wirk with linux)
  • Linux support from the manufacturer - download linux drivers here to get the firmware or load the demodulator firmware from here: http://www.tevii.com/dvb-fe-ds3000.rar and put the file dvb-fe-ds3000.fw at /lib/firmware. Drivers are already included in recent Linux kernels.

So: i recommend TeVii S470 DVB-S2 PCIe over Hauppage Nova HD-S2!

Update 2012: TeVii S471 works just the same, you only need the demodulator firmware as above.

But: the oom-killer hits me once a day here too:
Nov  5 13:54:06 willie kernel: [50751.489253] cx23885[0] dvb invoked oom-killer: gfp_mask=0xd4, order=0, oom_adj=0
Nov  5 13:54:06 willie kernel: [50751.489256] cx23885[0] dvb cpuset=/ mems_allowed=0
Nov  5 13:54:06 willie kernel: [50751.489259] Pid: 8120, comm: cx23885[0] dvb Not tainted 2.6.34.7-0.5-xen #1
Nov  5 13:54:06 willie kernel: [50751.489261] Call Trace:
Nov  5 13:54:06 willie kernel: [50751.489275]  [<ffffffff80009646>] dump_trace+0x76/0x1a0
Nov  5 13:54:06 willie kernel: [50751.489280]  [<ffffffff8040b286>] dump_stack+0x69/0x6f
Nov  5 13:54:06 willie kernel: [50751.489286]  [<ffffffff800d0f2f>] dump_header+0x8f/0xf0
Nov  5 13:54:06 willie kernel: [50751.489308]  [<ffffffff800d1021>] oom_kill_process+0x91/0x190
Nov  5 13:54:06 willie kernel: [50751.489312]  [<ffffffff800d1551>] __out_of_memory+0x41/0xb0
Nov  5 13:54:06 willie kernel: [50751.489316]  [<ffffffff800d1902>] out_of_memory+0x62/0xe0
Nov  5 13:54:06 willie kernel: [50751.489320]  [<ffffffff800d4925>] __alloc_pages_nodemask+0x615/0x630
Nov  5 13:54:06 willie kernel: [50751.489325]  [<ffffffff800fde71>] __vmalloc_area_node+0xf1/0x210
Nov  5 13:54:06 willie kernel: [50751.489329]  [<ffffffff800fe0b8>] vmalloc_32+0x28/0x30
Nov  5 13:54:06 willie kernel: [50751.489356]  [<ffffffffa05a8c62>] videobuf_dma_init_kernel+0x42/0xe0 [videobuf_dma_sg]
Nov  5 13:54:06 willie kernel: [50751.489371]  [<ffffffffa05a9340>] __videobuf_iolock+0x110/0x140 [videobuf_dma_sg]
Nov  5 13:54:06 willie kernel: [50751.489384]  [<ffffffffa062bd3a>] cx23885_buf_prepare+0xba/0x1b0 [cx23885]
Nov  5 13:54:06 willie kernel: [50751.489398]  [<ffffffffa053fbab>] __videobuf_read_start+0xdb/0x170 [videobuf_core]
Nov  5 13:54:06 willie kernel: [50751.489406]  [<ffffffffa054007e>] videobuf_read_start+0x1e/0x40 [videobuf_core]
Nov  5 13:54:06 willie kernel: [50751.489413]  [<ffffffffa05a0855>] videobuf_dvb_thread+0x45/0x1d4 [videobuf_dvb]
Nov  5 13:54:06 willie kernel: [50751.489420]  [<ffffffff80063f2e>] kthread+0x8e/0xa0
Nov  5 13:54:06 willie kernel: [50751.489425]  [<ffffffff80007e04>] kernel_thread_helper+0x4/0x10
Nov  5 13:54:06 willie kernel: [50751.489429] Mem-Info:
Nov  5 13:54:06 willie kernel: [50751.489430] DMA per-cpu:
Nov  5 13:54:06 willie kernel: [50751.489432] CPU    0: hi:    0, btch:   1 usd:   0
Nov  5 13:54:06 willie kernel: [50751.489434] CPU    1: hi:    0, btch:   1 usd:   0
Nov  5 13:54:06 willie kernel: [50751.489436] DMA32 per-cpu:
Nov  5 13:54:06 willie kernel: [50751.489437] CPU    0: hi:  155, btch:  38 usd: 110
Nov  5 13:54:06 willie kernel: [50751.489439] CPU    1: hi:  155, btch:  38 usd: 127
Nov  5 13:54:06 willie kernel: [50751.489440] Normal per-cpu:
Nov  5 13:54:06 willie kernel: [50751.489442] CPU    0: hi:  155, btch:  38 usd:  58
Nov  5 13:54:06 willie kernel: [50751.489444] CPU    1: hi:  155, btch:  38 usd: 134
Nov  5 13:54:06 willie kernel: [50751.489448] active_anon:56767 inactive_anon:36837 isolated_anon:0
Nov  5 13:54:06 willie kernel: [50751.489449]  active_file:4848 inactive_file:13849 isolated_file:0
Nov  5 13:54:06 willie kernel: [50751.489450]  unevictable:4 dirty:46 writeback:0 unstable:0
Nov  5 13:54:06 willie kernel: [50751.489450]  free:21611 slab_reclaimable:2723 slab_unreclaimable:10065
Nov  5 13:54:06 willie kernel: [50751.489451]  mapped:4766 shmem:1823 pagetables:0 bounce:0


latest findings: Belive it or not: The oom-killer was caused by a broken mainboard. Swapped the mainboard and it worked like a charm.


Lirc


Because it took some time to figure out: If you want to use a lirc based remote, then give vdr the path to the lirc socket. Add this option to vdr:

--lirc=/var/run/lirc/lircd