Sometime we need to convert audio/video from type to another for many reasons such as reduce the size of an email attachment, compatibility hell or others.Linux users are lucky enough to have a nice tool called ffmpeg.
Installation is easy and straight forward since ffmpeg tool is exist in most primary distributions repository.so we can use the package manager to install it. since i am running a fedora system i am going to us YUM.
The usage of ffmpeg is easy too, i will show few examples.
Example below is the simplest way, which is to pass the input file name and the output file name only.
Notice that we are providing the output file's extension too. There are many options for this tool, the most common are below.
Audio/Video
-i input file name
-b bitrate
-f format ( mp3,ogg,wav,avi,mp4...etc)
-fs file size, this option will trim your video when the size limit is reached
-y overwrite output files
-sameq covert but keep original quality
Video only
-r frame rate (fps)
-s set frame size (128x96,800x600,1920x1080...etc)
a little more advanced method were we put more options is use.
see the manual for all options
ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and re-size video on the fly with a high quality polyphase filter.
Installation is easy and straight forward since ffmpeg tool is exist in most primary distributions repository.so we can use the package manager to install it. since i am running a fedora system i am going to us YUM.
$ sudo yum install ffmpeg
The usage of ffmpeg is easy too, i will show few examples.
Example below is the simplest way, which is to pass the input file name and the output file name only.
$ ffmpeg -i mysong.wav mysong.mp3 # this will convert audio.wav to audio.mp3.
$ ffmpeg -i video.avi video.mp4 # same as the previous example.
Notice that we are providing the output file's extension too. There are many options for this tool, the most common are below.
Audio/Video
-i input file name
-b bitrate
-f format ( mp3,ogg,wav,avi,mp4...etc)
-fs file size, this option will trim your video when the size limit is reached
-y overwrite output files
-sameq covert but keep original quality
Video only
-r frame rate (fps)
-s set frame size (128x96,800x600,1920x1080...etc)
a little more advanced method were we put more options is use.
$ ffmpeg -i song.mp3 -y -b 44.1k -f ogg -fs 10M song
$ ffmpeg -i video.webm -y -b 44.1k -f avi -fs 100M -s 1920x1080 -r 60 video
see the manual for all options
$ man ffmepg