Thursday, December 2, 2010

How to convert an avi video to 3gp format in ubuntu

For this tutorial you will need:
  • The medibuntu repository
    sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
  • ffmpeg
    sudo apt-get install ffmpeg
  • libavcodec-extra-52
    sudo apt-get install libavcodec-extra-52
now just type
ffmpeg -i file.avi -ac 2 -s qcif -vcodec h263 -acodec libfaac -ar 48000 -y file.3gp
of course you have to replace file.avi and file.3gp with the name of the input file and the desired output file.

be careful that the parameter -ar 48000 is set to the right speed (you can check the speed of the input video from the properties)

Now let's have a look to the parameters:
  • -i file.avi to specify the input file
  • -ac 2 to set 2 audio channels
  • -s qcif to set the size of the output video. qcif corresponds to 176x144. To view all the available values type "man ffmpeg"
  • -vcodec h263 to set the video codec
  • -acodec libfaac to set the audio codec
  • -y to overwrite output files
that's it