Hallo
Hab mal ein kleines script gebastelt, das die Tools: mplayer, mencoder, faac, normalize-audio, (lib)x264 und MP4Box nutzt, um aus einer Datei oder DVD eine MP4 Datei mit x264+aac Codec zu machen.
Die x264 Encoder optionen habe ich einfach von dem mencoder How-To genommen, keine ahnung ob man die wirklich für jeden Film ändern muss.
Ob diese Einstellungen und die Art und Weise, wie ich die MP4 zusammen bastele SAP-standard-konform ist weiß ich auch nicht.
Vielleicht kann einer der Gurus dazu etwas sagen.
Hier nun das script:
Bash
#!/bin/bash
if [[ $# -ne 2 ]] ; then
echo usage: $0 source crop
echo example: $0 file.foo 704:416:8:80
echo ""
echo 'possible VARs: '
echo 'AID=129 - change language stream, (128 is default)'
echo 'QP=22 - change x264 Quality Mode (24 = default, 0 = lossless)'
echo 'AQ=95 - change vbr quality (100=128kbps, 90=80kbps, 95 is default)'
echo ""
echo example: AID=130 QP=20 AQ=93 $0 Film 560:432:12:72
exit 1
fi
if [[ $2 == none ]] ; then
crop="720:576:0:0"
else
crop="$2"
fi
if [[ $AID == '' ]] ; then AID=128 ; fi
if [[ $QP == '' ]] ; then QP=24 ; fi
if [[ $AQ == '' ]] ; then AQ=95 ; fi
if [[ -f '$1'.264 ]] ; then rm -i "$1".264 ; fi
if [[ -f '$1'.log ]] ; then rm -i "$1".log ; fi
if [[ -f '$1'.wav ]] ; then rm -i "$1".wav ; fi
if [[ -f '$1'.m4a ]] ; then rm -i "$1".m4a ; fi
if [[ -f '$1'.mp4 ]] ; then rm -i "$1".mp4 ; fi
if [[ ! -f '$1' ]] ; then
echo -e '\E[48;33m''\033[1m### DATEI NICHT GEFUNDEN, VERSUCHE DVD ZU RIPPEN ###\033[0m'
mplayer -really-quiet dvd:// -dumpstream -dumpfile '$1'
fi
echo ''
echo ''
echo 'ok, mencode $1 mit '
echo CROP=$crop
echo AID=$AID
echo QP=$QP
echo AQ=$AQ
echo ''
echo ''
if [[ ! -f '$1'.wav ]] ; then
echo ""
echo -e '\E[48;32m''\033[1m### DUMP AUDIO STREAM ###\033[0m'
mplayer -really-quiet -aid $AID -vo null -ao pcm:fast:file='$1'.wav '$1' || exit 1
echo ''
echo -e '\E[48;32m''\033[1m### NORMALIZE AUDIO STREAM ###\033[0m'
normalize-audio '$1'.wav || exit 1
else
echo ''
echo -e '\E[48;33m''\033[1m### AUDIO STREAM ALREADY DUMPED ###\033[0m'
fi
if [[ ! -f '$1'.m4a ]] ; then
echo ""
echo -e '\E[48;32m''\033[1m### ENCODE AUDIO STREAM TO AAC ###\033[0m'
faac -w -q $AQ '$1'.wav -o '$1'.m4a || exit 1
else
echo ''
echo -e '\E[48;33m''\033[1m### AUDIO STREAM ALREADY ENCODED ###\033[0m'
fi
if [[ ! -f '$1'.log ]] ; then
echo ""
echo -e '\E[48;32m''\033[1m### ENCODE VIDEO STREAM TO X264 1ST PASS ###\033[0m'
nice -n 5 mencoder '$1' \
-o '$1'.264 \
-of rawvideo \
-nosound \
-vf crop=$crop \
-passlogfile '$1'.log \
-ovc x264 -x264encopts qp='$QP':subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:pass=1:turbo=1:threads=1 || exit 1
rm '$1'.264
else
echo ''
echo -e '\E[48;33m''\033[1m### 1ST PASS ALREADY ENCODED ###\033[0m'
fi
if [[ ! -f '$1'.264 ]] ; then
echo ""
echo -e '\E[48;32m''\033[1m### ENCODE VIDEO STREAM TO X264 2ND PASS ###\033[0m'
nice -n 5 mencoder '$1' \
-o '$1'.264 \
-of rawvideo \
-nosound \
-vf crop=$crop \
-passlogfile '$1'.log \
-ovc x264 -x264encopts qp='$QP':subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:pass=2:threads=1 || exit 1
else
echo ''
echo -e '\E[48;33m''\033[1m### 2ND PASS ALREADY ENCODED ###\033[0m'
fi
if [[ ! -f '$1'.mp4 ]] ; then
echo ""
echo -e '\E[48;32m''\033[1m### MUX VIDEO AND AUDIO STREAM TO MP4 ###\033[0m'
MP4Box -fps 25 -add '$1'.264 -add '$1'.m4a:lang=de '$1'.mp4 || exit 1
else
echo ''
echo -e '\E[48;33m''\033[1m### ALREADY MUXED ###\033[0m'
fi
echo ''
echo -e '\E[48;32m''\033[1m### DONE ###\033[0m'
Alles anzeigen
cu