X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;ds=sidebyside;f=mkv2mp4;fp=mkv2mp4;h=afbd0a8adb25b95a4f9c410395667421900e5f8d;hb=9580365135dbaa7c89e0e30f097c566e9a3a6650;hp=463c3d3852884b68bbcb1fa80e613bad5993e8a7;hpb=c67ee10afd440a0f4eae901512b614e7d8c7deea;p=videoscripts%2F.git diff --git a/mkv2mp4 b/mkv2mp4 index 463c3d3..afbd0a8 100755 --- a/mkv2mp4 +++ b/mkv2mp4 @@ -1,12 +1,27 @@ #!/bin/bash -# step 1: convert the mkv to mpg ; many mkv files do not directly get converted to mp4 -mencoder "$1" -ovc lavc -lavcopts vcodec=mpeg1video -aid 0 -oac pcm -o delete_me.mpg +INPUT=$1 +FILENAME=${INPUT%%.*} +OUTPUT="$FILENAME.mp4" -# step 2: convert the mpg file to mp4 -mencoder -of lavf -lavfopts format=mp4 -oac lavc -ovc lavc -lavcopts \ -aglobal=1:vglobal=1:acodec=libfaac:vcodec=mpeg4:abitrate=128:vbitrate=640:keyint=250:mbd=1:vqmax=10:lmax=10:turbo -af lavcresample=44100 \ --vf harddup,scale=640:-3 "delete_me.mpg" -o "$1.mp4" +echo "-> Converting $INPUT to $OUTPUT file" -# step 3: delete the temporary huge sized mpg file -rm "delete_me.mpg" +if [[ -e "$OUTPUT" ]]; then + echo "-E- Output file $OUTPUT already exists. Aborting..." + exit 1 +fi + +ffmpeg -i $INPUT \ + -b:v 3000k \ + -vcodec libx264 \ + -acodec copy \ + -coder 1 \ + -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 \ + -subq 5 \ + -me_range 16 \ + -g 250 \ + -keyint_min 25 \ + -sc_threshold 40 \ + -i_qfactor 0.71 \ + -threads 2 \ + $OUTPUT