Converting Audio and Videos using FFMPEG

I was simply ignoring writing this articles but after writing articles on Installing FFMPEG on Linux i couldn’t resist on writing this article. Anyways this article will guide you on how you can convert audio video formats using FFMPEG.

This articles in divided in various sections

  • Parameter Used
  • Command Line Syntax
  • Conversion Examples

Parameter Used:
Common Parameters

-i ‘filename’Filename will be the Path of Source Filename
-yOverwrite the existing output file without prompting
-andisable audio

Video Related Parameters

-aspect ‘aspect ratio’Set Aspect Ratio for the video (4:3, 16:9 or 1.3333, 1.7777)
-r ‘rate’set frame rate in Hz for the video
-s ‘size’set video resolution size (Width x Height)
-samequse same video quality as source

Audio Related Parameters

-ar ‘rate’set audio sampling rate (in Hz)
-acodec ‘codec’force audio codec E.g. mp3
-vol ‘volume’change audio volume (256=normal)
-ab ‘rate’set audio bit rate (in bits/s)

Advanced Parameters

-map_meta_data output file:input fileCopy the Metadata from Input File to Converted output file

Command Line Syntax
ffmpeg –i ‘input filename’ ‘output filename’

  • Syntax Example:
    [root@linux /]# ffmpeg -i demo.mpg demo.flv
    Here FFMPEG will convert demo.mpg file to demo.flv

Conversion Examples:

Video Examples:

  • Converting MOV to FLV using FFMPEG
    ffmpeg -i movie1.flv
    This will convert file to movie1.flv
  • Converting Mpeg to FLV using FFMPEG
    ffmpeg -i movie1.mpeg movie1.flv
    This will convert movie1.mpeg file to movie1.flv
  • Converting AVI to FLV using FFMPEG
    ffmpeg -i movie1.avi -s 500×500 movie1.flv
    This will convert movie1.avi file to movie1.flv and will resize the video resolution to 500×500
  • Converting 3GP to FLV using FFMPEG
    ffmpeg -i movie1.3gp -sameq -an movie1.flv
    This will convert movie1.3gp file to movie1.flv and will keep the original file settings and will disable the audio content
  • Converting MPEG to 3GP using FFMPEG
    ffmpeg -i movie1.mpeg -ab 8.85k -acodec libamr_wb -ac 1 -ar 16000 -vcodec h263 -s qcif movie2.3gp

Audio Examples:

  • Converting aac to mp3 using FFMPEG with MetaData
    ffmpeg -i audio1.aac -ar 22050 -ab 32 -map_meta_data audio1.mp3:audio1.aac audio1.mp3
    This will convert audio1.aac to audio1.mp3 having audio rate 22.05 Khz and Audio BitRate 32Khz and will copy the meta data from .aac file to .mp3 file
  • Converting WMV to MP3 using FFMPEG
    ffmpeg -i audio1.wmv audio1.mp3
    This will convert audio1.wmv file to audio1.mp3
  • Converting WMV to FLV using FFMPEG
    ffmpeg -i audio1.wmv audio1.flv
    This will convert audio1.wmv file to audio1.flv, this will generate only audio content
  • Converting AMR to MP3 using FFMPEG
    ffmpeg -i audio1.amr -ar 22050 audio1.mp3
    This will convert audio1.amr file to audio1.mp3 having audio rate 22.05 Khz
  • Converting aac to mp3 using FFMPEG
    ffmpeg -i audio1.aac -ar 22050 -ab 32 audio1.mp3
    This will convert audio1.aac to audio1.mp3 having audio rate 22.05 Khz and Audio BitRate 32Khz

Related Articles:

About Hitesh Agrawal

Wait... checking
Tagged . Bookmark the permalink.

69 Responses to Converting Audio and Videos using FFMPEG

  1. FDisk says:

    @Nishad Aliyar
    try this:
    exec(“../ffmpeg -i -sameq 1.flv”);

  2. vijesh says:

    hi tulio,

    Try the following command to convert FLV to 3gp

    ffmpeg -i input.flv -acodec libfaac -ab 12.65k -ac 1 -ar 16000 -vcodec h263 -s qcif -r 15 outfile.3gp

    Vijesh Vijayan

  3. blackoutworm says:

    Some people don’t know this, but this isn’t converting.
    You don’t convert anything by copying the file with a new extension at the end.
    Yes, -i is the comment for converting, but in order to convert something you need to include the codecs info, bitrate / quality, and all that.
    If you don’t put in the bitrate or quality, the resolution will be the same.
    But you still need to tell ffmpeg what codec it can use for this.

  4. crossgun says:


    Is it a must that some codecs must be installed for ffmpeg to properly convert a video? I’m trying to convert videos into h.264 mp4 formats but I’m not successful at all even though I tried many things that I got from the web. I have this following installed on my ffmpeg:

    libavutil 50. 3. 0 / 50. 3. 0
    libavcodec 52.37. 0 / 52.37. 0
    libavformat 52.39. 1 / 52.39. 1
    libavdevice 52. 2. 0 / 52. 2. 0
    libswscale 0. 7. 1 / 0. 7. 1

    Am I missing something?

  5. Thomas says:


    Command used to convert wav file to mp3 format: ffmpeg -i input.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output.mp3
    To know more visit:

  6. Thunder says:

    On Windows default ffmpeg settings are enough to convert from any format to another. Following is a simple example

    ffmpeg -i audio1.wmv audio1.flv

    Although you may need to add few additional parameters like bitrate, frame rate etc. to preserve quality. In Linux, such parameters are sometimes mandatory to convert properly.

  7. D4eRc says:

    @ Thunder
    ffmpeg parameters do not differ between windows and linux. When the same codecs are installed as well on linux and on the windows side, using no additional parameters will produce nearly the same file.
    If this is not the case, give me a proof.

  8. Pingback: Converting 3gp to xvid using Linux and ffmpeg | The Internet made me do it!

  9. Pingback: Creating a FLV Video File on Mac OS X : Steven Winterhalter

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>