H's Blog A good shell is the best user interface.

15Aug/101

Fix VDR Recordings (MPEG-PS)

I currently use the following script to copy a VDR recording into a MPEG-PS container using a very robust input decoder, so any error in the recording is fixed:

#!/bin/bash

for f in "$@"; do
    [ -r "$f" ] || continue
    g="$(basename "$f" .vdr).mps"
    [ -e "$g" ] && continue
    mencoder -forceidx -lavdopts er=4 -vc ffmpeg12 -of mpeg -oac copy -ovc copy "$f" -o "$g"
done

Since audio/video is just copied to the destination, this step should be fairly loss-less and fast.

Tagged as: , , 1 Comment
22Jul/102

Streaming MPEG-TS

Up to release 1.6 VDR is recording into MPEG-PS files named *.vdr.
In newer release this was switched to MPEG-TS (with some impact on moving marks).
The Asus O!Play is fine with the TS (Transport Stream) format, but lacks support of the *.vdr files.

Since I want to stick to release 1.6 of VDR for now, I just wrote a script, that will convert the recordings into MPEG-TS files using ffmpeg, all contained on a Samba export, which is connected to the streaming device:

#!/bin/bash
find . -type f -name "???.vdr" | while read vdr; do
  dir="$(dirname "$vdr")"
  file="$(basename "$vdr" .vdr)"
  target="$dir/$file.mpg"
  [ -f "$target" ] && continue
  nice ffmpeg -i "$vdr" \
    -vcodec copy \
    -acodec copy \
    -scodec copy \
    -sameq \
    -f mpegts \
    "$target"
done

Since only the container format changes, this script does not cost that much performance and I can even run it without larger problems on my Atom-driven VDR host.