Converting Audio/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 |
| -y | Overwrite the existing output file without prompting |
| -an | disable 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) |
| -sameq | use 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 file | Copy 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.mov movie1.flv
This will convert movie1.mov 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
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
Similar Posts
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.
Comments
hi,
How to convert a file in two different audio bit rates (eg 64 kb and 128 kb)in one command. What is the -map_meta_data can you explain it in details.
Thanks,
Pravin k.
hi,
I think we can convert the in multiple bit rate in one command.That is workable but I did not understand the -map 0:0 -map 0:0 part in the
ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
can u explain it …
-pravin
Hi, i am trying to convert some mp4 files captured from a mobile phone. It works fine with -an command (no sound) but i need sound too.
Thank You
sorry it was my fault. the audio bit rate for that file was not included in ffmpeg default audio rates; so a command like
ffmpeg -i 11122007012.mp4 -ar 11025 test.flv
worked very nice.
Thank you for this great tutorial
Hi,
Can I convert a WMV file to MPEG4 format file with the audio as it was. I have used the following command -
>ffmpeg -i Bear.wmv -b 600 -s 320×240 -vcodec mpeg4 -acodec copy -f mp4 Bear.mp4
But unfortunately the output is not good. Audio is absent and the video quality is very poor. Could you please suggest me what is wrong in this command.
Regards
litak
hi,
for Converting 3GP to FLV using FFMPEG as per your above example following command will convert video but without sound.
ffmpeg -i movie1.3gp -sameq -an movie1.flv
But i want to convert video with sound. Sound should be remain as it is. Can anybody please give me proper command to convert 3gp to flv.
Thanks in advance.


This is by far the best guide for ffmpeg on the web.
Thank you very much!