Thats not all. It can also be used for more advanced functions like slowing down the frame rate, resizing the video and many more. Good news for geeks. FFmpeg is CLI based. So you don't need to struggle with those unbearable mouse clicks. The latest stable release version of FFmpeg is 0.6.
Converting a video using the command line.Warning. Now if the word "command line" gives you a heart attack then you should probably skip this section and jump straight to the bottom of the page.
FFmpeg is mainly used for converting videos from one format to another. Duh!!. The most common syntax of using FFmpeg consists of the input of the file followed by the output file in the desired format.
Exampleffmpeg -i inputvideo outputvideo.
Sounds so simple right? Well there is a glitch. The quality of the output (bit rates, frame rate) gets degraded when we use this format.
To avoid this problem we will use a number of options along with the command . Suppose we want to convert a .avi file to .flv video. Use the following command.
ffmpeg -i input.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv final.flv
After the execution processing takes place and you should see a screenshot like the one below:
No doubt, the command is very long but it is also very easy to understand. Now let's get to know those cryptic options-
- -i = input the file
- -ab = set the audio bitrate
- -ar = setting the audio frequency
- -b = video bitrate
- -r = video frame rate
- -s = size of the video display
- -f= format
- -vcodec – is the video codec we want to use during the conversion
- -acodec- It is the audio codec we want to use during the conversion
Now lets try out some more popular options.
Convert videos from .avi to divx format.
ffmpeg -i input.avi -s 320x240 -vcodec msmpeg4v2 output.aviConvert videos from .avi to dv format
ffmpeg -i input.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 final.dvConvert videos from .mpg to .avi format
ffmpeg -i input.mpg ouput.aviConvert videos from wav file to mp3 format
ffmpeg -i input.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output.mp3Convert videos from ogg theora to mpeg format
ffmpeg -i input.ogm -s 720x576 -vcodec mpeg2video -acodec mp3 ouput .mpgChanging the Frame Rate
Frame rate can be defined as the number of frames displayed per sec. Frame rate is directly proportional to the speed of the video and is mainly responsible for the animation or continuous stream of images. Phew..!! Now we do not want to sound like your math teacher.
Sometimes it's necessary for the developers to slow down the frame rate of the video , so that they can better understand about the minute changes in the video. This can be done only by including the -r option.
Syntax for the same is ffmpeg -i inputfile -r 5 outputfile.
This will create the output video with a rate of 5 frames per second. When played, you will observe the slow processing of the video.
Extracting Audio From The VideoSometimes you only need the audio. FFmpeg is capable of extracting the audio from the videos too .
ffmpeg -i input.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio.mp3
The -vn option holds the key to this command. This option is used when we want to disable the video recording. Executing the upper command will extract the audio file from the input.avi and willl save it under the name of “audio.mp3” .You can add more appropriate options in between if you want to juice the maximum from this niftly tool.
Converting Images To Videos Now here is a neat little trick.
Suppose you have a collection of images named as say image1.jpg,image2.jpg and you want to view them in the video format. FFmpeg can do this job as well. You can do this by running this command on the shell.
ffmpeg -f image2 -i image%d.jpg output.mpg.
You can also do this in the reverse. So there you go. Complete video converting in Ubuntu. Play with the options and you are likely to find more cool tricks.
So thats with the geek stuff. If you want a more comprehensive list of options then type the following command in the terminal.man ffmpegWinFF : GUI Client of FFmpeg
Okay. I guess you jumped straight to this one.
If you are not comfortable with the cli , don't worry there is an equivalent GUI client for the FFmpeg called “WinFF” and it is so much more easier to use.
You can install it from the repository in ubuntu by typing
sudo apt-get install winffTo open it either use type winff in the terminal or you can go to the Applications → Sound & Video → Winff . You will see the screenshot like below
As you can see, the GUI makes the setup much more easier.
Input your video by clicking the “Add” button on the top. Then select the video and from the top down menu select the output options according to your need . Then click on the convert button on the top panel and that's it . You are done with the formating. To set the audio video rate you need to use the”options” button. It will display the extra settings panel at the bottom of the output settings just like
WinFF is also cross-platforrm, being an open source, GPL licensed software.REFERENCES
http://ubuntumanual.org/posts/327/converting-videos-in-ubuntu-using-ffmpeg-the-ultimate-free-video-converter