Created
May 2, 2011 21:01
-
-
Save morgner/952354 to your computer and use it in GitHub Desktop.
Convert MTS files to MOV format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
for F in `ls -1 *.MTS` | |
do | |
echo Recoding $F | |
FILE=${F%%.*} | |
ffmpeg -y -i ${FILE}.MTS -vn -acodec pcm_s16le -ac 2 a${FILE}.wav | |
YUV="yuv420p" | |
ffmpeg -y -r 24 -i ${FILE}.MTS -an -pix_fmt ${YUV} -r 24 -f rawvideo v${FILE}.yuv | |
ffmpeg -y -i a${FILE}.wav -s 1440x1080 -i v${FILE}.yuv -acodec pcm_s16le -ac 2 -vcodec mpeg4 -sameq -aspect 16:9 -r 24 -copyts ${FILE}.mov | |
rm a${FILE}.wav | |
rm v${FILE}.yuv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script converts all MTS files in the current directory to MOV files (the MTS originals are kept) trying to minimize any impact on quality and file size. The intermediate files WAV and YUV may become huge (!) but the resulting MOV will be acceptable. The most important parameters are:
-s ...
-sameq
-aspect ...
With these parameter, quality and aspect ratio are adapted from source to destination. You may need to change them for your camera type or recording resolution settings.