Skip to content

Instantly share code, notes, and snippets.

@armando-basile
Created October 16, 2018 19:38
Show Gist options
  • Save armando-basile/98618aec0450d81ce75bb1371cf6a79c to your computer and use it in GitHub Desktop.
Save armando-basile/98618aec0450d81ce75bb1371cf6a79c to your computer and use it in GitHub Desktop.
bash script to use ffmpeg to merge MTS files and encode with x264
#!/bin/bash
# merge more mts file
actualdir="`pwd`"
if [ -z "$1" ]; then
echo -e "Nessun argomento trovato !!!\nDevi specificare la path della cartella degli MTS da unire\n"
fi
cd "$1"
FILES=`ls -1 *.MTS`
FILESVAR=""
# concatenamento dei nomi dei file MTS
for i in $FILES ; do
FILESVAR="$FILESVAR$i|"
done
# creazione del comando
ffmpeg -i "concat:$FILESVAR" -vf yadif -vcodec libx264 -preset slow -crf 19 -acodec aac -ab 320k -cutoff 22050 -sn out.mkv
# solo merge usa invece
#ffmpeg -i "concat:$FILESVAR" -vcodec copy -acodec aac -ab 320k -cutoff 22050 -sn out.mp4
# ritorno alla cartella di origine
cd $actualdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment