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

7Sep/102

Merge/Join MP4 Videos

Using cat on the command line to simply merge multiple MPEG4 files into one, will just not work. VLC will stop after the first part.
But this is not really surprising, the header is originating from the first file and still contains the information about the single file.
I am now using a mencoder wrapper script to merge multiple MPEG4 files into a new MPEG4 container named complete.mp4:

#!/bin/bash

if [ -s "complete.mp4" ]; then
    echo "$0: complete.mp4 exists... bailing out."
    exit 1
fi
exec mencoder "$@" -ovc copy -oac copy -of lavf -lavfopts format=mp4 -o complete.mp4

This script will deny to overwrite an existing non-empty complete.mp4. So drop a pre-existing file of that name first.

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