#!/bin/sh renice 19 $$ > /dev/null schedtool -B $$ > /dev/null fail() { echo Failed abort } videofile="crap.m2v" audiofile="crap.ac3" moviefile="%d_crap.mpg" if [[ -x $videofile || -x $audiofile ]] ; then echo File exists fail fi for i in `find -type f | sort` do filetype=`file -b $i` if [[ ! $filetype = "MPEG system stream data" ]] ; then continue fi echo appending video from $i to $videofile tcextract -i $i -x mpeg2 >> $videofile if (( $? )); then fail fi echo appending audio from $i to $audiofile tcextract -i $i -x ac3 >> $audiofile if (( $? )); then fail fi done mplex -f 8 -o $moviefile $videofile $audiofile if (( $? )); then fail fi rm -v -f $videofile $audiofile videofiles=`ls -1 *crap.mpg | sort -n` dvdauthor -o crap $videofiles if (( $? )); then fail fi rm -v -f $videofiles