From c6aa16e1d7e894df6c9155f8c3b81cdcb2579baa Mon Sep 17 00:00:00 2001 From: Calin Burloiu Date: Fri, 10 Dec 2010 11:20:41 +0200 Subject: [PATCH 1/1] add ffmpeg based conversion scripts --- ffmpeg-all-mts2avi | 20 ++++++++++++++++++++ ffmpeg-mts2avi | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 ffmpeg-all-mts2avi create mode 100755 ffmpeg-mts2avi diff --git a/ffmpeg-all-mts2avi b/ffmpeg-all-mts2avi new file mode 100755 index 0000000..ff10130 --- /dev/null +++ b/ffmpeg-all-mts2avi @@ -0,0 +1,20 @@ +#!/bin/bash +# +# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com +# +# This scripts converts all mts files to avi starting from a root directory +# recursively. The avi files are placed in the same directory as the +# original mts files. +# + +if [ $# -ne 1 ]; then + echo "usage: $0 root_path" +fi + +root_path=$1 + +for i in $(find $root_path -name "*.mts"); do + #echo $(dirname $i)/$(basename $i .mts).avi + ./ffmpeg-mts2avi $i "$(dirname $i)/$(basename $i .mts).avi" + +done diff --git a/ffmpeg-mts2avi b/ffmpeg-mts2avi new file mode 100755 index 0000000..bcd63f0 --- /dev/null +++ b/ffmpeg-mts2avi @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com +# +# This script converts an MTS file into an AVI file, which +# contains an H.264 video stream and and an MP3 audio stream. +# + +if test $# -ne 2; then + echo "Usage: $0 mts-file avi-file" + exit 1 +fi + +MTS_FILE=$1 +AVI_FILE=$2 +FFMPEG=/usr/bin/ffmpeg + +if test ! -f $MTS_FILE; then + echo "Error: No such file $MTS_FILE" + exit 1 +fi + +$FFMPEG -i "$MTS_FILE" -f avi -acodec libmp3lame -ab 256k -ar 44100 -ac 2 -vcodec libx264 -vpre normal -b 1400k -r 30 -threads 0 "$AVI_FILE" + -- 2.20.1