Skip to content

Instantly share code, notes, and snippets.

@parixitjani
Last active August 10, 2017 08:55
Show Gist options
  • Save parixitjani/5c5206c3868e8f78dc20f89aa4273b08 to your computer and use it in GitHub Desktop.
Save parixitjani/5c5206c3868e8f78dc20f89aa4273b08 to your computer and use it in GitHub Desktop.
for mfile in $ifiles
do
outfile=${mfile%.*}
ext=${mfile##*.}
#convert to mp4 if file is not mp4
if [ $ext != 'mp4' ]
then
_ffmpegcmd1="ffmpeg -loglevel panic -y -i $mfile -deinterlace -pix_fmt yuv420p -an -vf scale=640:trunc(ow/a/2)*2 -vcodec libx264 -threads 0 "$outfile".mp4"
$_ffmpegcmd1
fi
_ffmpegcmd2="ffmpeg -loglevel panic -y -i "$outfile".mp4 -deinterlace -pix_fmt yuv420p -an -vf scale=640:trunc(ow/a/2)*2 -c:v libx264 -r 60 -c:a aac -ar 48000 -b:a 160k -strict experimental -f mpegts "$outfile".ts"
$_ffmpegcmd2
vfile="$vfile""$outfile"".ts""$seperator"
done
ffmpeg -loglevel panic -y -i "concat:$vfile" -c copy -bsf:a aac_adtstoasc $ofile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment