2012年9月18日火曜日

mencoderを使い、 Everio GZ-E265の彩度上げ、再圧縮、音ズレ最小限

http://www.linuxquestions.org/questions/linux-software-2/mts-video-conversion-672091/
ここのスクリプトを改造して、 Everio GZ-E265のMTSファイルを彩度を上げて、Xvid aviに圧縮した。
映像と音を分離して、再合成すると、音ズレが少なくなった。

#!/bin/bash

if [ ! $1 ] || [ ! $2 ] || [ ! $3 ] || [ ! $4 ]; then
echo "USAGE: Input_MTS_File Output_MP4_File Output_WAV_File Output_MPEG_File"
exit 1
fi

INFILE=$1
MP4FILE=$2
WAVFILE=$3
MPEGFILE=$4

echo $INFILE $MP4FILE $WAVFILE $MPEGFILE

file $INFILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# export video ONLY to an MP4 file
ffmpeg -i $INFILE -r 60000/1001 -sameq -f mp4 -vcodec mpeg4 -an -r 30000/1001 $MP4FILE


file $MP4FILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# export audio ONLY to a WAV file
ffmpeg -i $INFILE -vn $WAVFILE

file $WAVFILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# merge the MP4 file and WAV file while converting 60fps to 30fps.
# NOTE: tried to do that in the first step (-r 60000/1001), but it didn't work apparently.

mencoder -of avi \
-ovc xvid -xvidencopts fixed_quant=6:vhq=4:chroma_opt:gmc \
-vf pp=al,hue=-0.0:1.4,pp=ac,yadif=0,harddup -fps 30000/1001 -ofps 30000/1001 -oac lavc \
-audiofile $WAVFILE $MP4FILE -o $MPEGFILE


file $MPEGFILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# END #