#!/bin/sh #we assume two things, that you're already using mp2 audio and that want it #and also that where ever mktemp creates the files will have enough free space to do this #and also the settings that you'll want to encode the mp2 audio at #i should really check to see if you have the tools needed to make everything #and that ALL files are sucessfully created before removing the original file (edit the script if you just want to move it out of the way to .old or something) REQUANTFACTOR = 10 MPLEXFORMAT = 8 IN=$1 NEW=$1.new TMP=`mktemp -t reqXXXXXX` mpgdemux $IN -b $TMP tcrequant -f $REQUANTFACTOR -i $TMP-0.m2v -o $TMP-1.m2v lame --decode $TMP-0.mp2 - | toolame -b 112 -s 48 - $TMP-1.mp2 mplex -f $MPLEXFORMAT -o $NEW $TMP-1.mp2 $TMP-1.m2v && (rm -f $IN; mv $NEW $IN) rm -f $TMP $TMP-*