Shrink VDR Recordings (MP4)

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

#!/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 evaluating the ffmpeg parameters and additional calls to avidemux to merge parts and establish audio/video sync.

Sometimes it’s necessary to save the stream with -700ms timeshift after the ffmpeg conversion.

I found the x264 presets in search results for ffpresets 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 requirements on file size and video quality.