sodnpoo.com

convert to 3gp

Another small video conversion script. I started a new job recently and now I spend a few hours a day on a train so I needed to be able to convert media to 3gp (although technically I think mpeg4/aac/3gp is a 3g2...). This is what I came up with.

On ubuntu I had to build ffmpeg from source to get libfaac/aac support.

  
#!/bin/bash

flags="-threads 5 -f 3gp -vcodec mpeg4 -b 128k -ab 64k -s 320x240 -r 15 
-acodec libfaac -ar 48000 -ac 2 -passlogfile ./fflog"

#uncomment to cut 26 seconds off the beginning
#flags="-ss 26 ${flags}"

for input in "$@"
do
  echo "input file  : $input"
  output="${input%.*}.3gp"
  output="./${output##*/}"
  echo "output file : $output"
  echo
  
  nice ~/bin/ffmpeg -y -i "$input" ${flags} -pass 1 /dev/null  
  nice ~/bin/ffmpeg -y -i "$input" ${flags} -pass 2 "$output"
  rm ./fflog*.log
done