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

1Feb/113

UPnP for VDR’s Live Streams

I recently realized, that I just have to announce streams by UPnP to access them using my Asus O!Play.

Since my VDR installation provides URLs like http://MyVDRHostname:3000/EXT/ChannelNo access to the live channels, I started using MediaTomb to publish the URLs by UPnP.

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
24Jul/100

Shrink VDR Recordings (MP4)

I currently use the following ffmpeg script to convert the recordings of my VDR 1.6 to more handy MPEG4 files:

#!/bin/bash

profile="-vpre hq"
quality="-crf 26"   # constant quality
prefix="nice"         # "nice ionice -c3"

for i in "$@"; do
    [ -r "$i" ] || continue
    output="$(basename "$i" | cut -f 1 -d .).$profile.mp4"
    [ -e "$output" ] && continue

    $nice ffmpeg -i "$i" -acodec copy -scodec copy -threads 0 \
        -vcodec libx264 $profile $quality "$output"
done

But I am still testing the ffmpeg parameters and I use additional calls to avidemux to merge parts and establish audio audio/video sync.
Sometimes I have to save the stream with -700ms shift after the ffmpeg conversion.
I got the x264 presets at the ffmpeg repository and downloaded them to $HOME/.ffmpeg, so the vpre option will not complain.
Of course the quality setting is subject to your personal constraints to file size and video quality.

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.

10Jul/106

Streaming VDR

Since my VGA to PAL adapter for my VDR host is not really working well for video, I am now owner of a media player that covers the following options:

  • low-cost
  • wired networking capabilities
  • support of "open" formats
  • small, moderate power consumption, ...


The Asus O!Play HDP-R1 meets these requirements. But there are still some issues:

  • VDR/MPEG-PS is not working, so I have to convert most of my VDR recordings. In contrast MPEG-TS provided by bleeding-edge releases of VDR is working well.
  • MKV (Matroska) is showing strange speed changes in first tests. I am currently testing, if this is related to the server system. In tests I just converted the VDR/MPEG-PS container to a MKV container leaving the contents as is.
  • I have not testet the setup with HDMI, since our TV just don't give up, it's still a low-resolution PAL system. But it's pure weight is an advantage in the context of playing children :-) .
Tagged as: , , 6 Comments