10 FFmpeg Commands You Should Know for Media File Conversions

FFmpeg contains a number of library files that help you manipulate your media files. This free tool allows you to play around with your media files and provides you the ability to get their data, convert them from one media format to another, extract audio out of a video file, and so on.

FFmpeg has a number of features and works on all the popular operating systems including Windows, Mac, and Linux. So, if you happen to have one of these operating systems and would like to learn some of the FFmpeg commands to help you modify your media files, then the guide below is all you need.

Whether you run Windows, Mac or Linux, downloading and installing the FFmpeg tool is fairly easy.

If you use a Windows computer, head over to the FFmpeg Windows repository to download either a 32-bit or a 64-bit version of the tool. Once it’s downloaded, extract files from the archive, and then you can begin to use the tool using a command prompt window.

If you happen to be on Mac, you can head over to the FFmpeg Mac downloads page to download the Mac version of the tool. Once downloaded, extract it and then use the Terminal app to begin using the tool and its commands.

Linux users can find the FFmpeg library in your package manager. If not, head over to the FFmpge’s Linux downloads page and download the tool and use it on your machine.

Note: I am going to be using these commands on a Mac, so I will prefix the commands with “./”. Windows users don’t need to do this.

If you have a media file on your computer and would like to know the information for it, then you can use the following command that fetches the information from the file and shows it on the screen. Replace “video.mp4” with the name of the media file you have on your computer.

ffmpeg -i video.mp4 -hide_banner


The reason we have used the hide_banner flag is because we don’t want to see the copyright information about FFmpeg. We are only interested in knowing the information about the media file and that’s it.

If you happen to have a video file on your computer that you would like to convert to MP3 so that you can listen to it, then FFmpeg can help you do that with the following command.

ffmpeg -i video.mp4 audio.mp3


The command will turn a video file called “video.mp4” into an audio MP3 file. The file will be saved in the same folder as the video file.

Not all the devices can play all types of video files. For instance, a video file that plays in .flv format on your computer may or may not play on your mobile device. So, you need to first convert the video into a compatible format to be able to play it on another device.

FFmpeg can help you convert your videos from one format to another, and it can be done using the following command:

ffmpeg -i video.mp4 output.avi


The above command will convert an MP4 video to an AVI video file.

GIFs are animated image files. With FFmpeg, you can have your videos converted into these animated GIFs to be uploaded to your social profiles.

ffmpeg -i video.mp4 myanimation.gif


The above command will turn your video file into an animated GIF file called “myanimation.gif”.

Sometimes you may want to make a video silent for your own reasons, and the tool can help you do that by letting you remove the audio from the video file and making the video completely silent.

ffmpeg -i video.mp4 -an silent-video.mp4


It will turn a video called “video.mp4” into a silent video file called “silent-video.mp4.” The video should play, but in silent mode, as it no longer has audio attached to it.

FFmpeg can also help you resize your videos so that they are of the size you really want them to be in.

ffmpeg -i video.mp4 -vf scale=320:240 resized-video.mp4


The above command will resize the input video to a 320 x 240 resolution output video. You can specify your own resolution in the command and it will convert accordingly.

If you’re going to upload your audio file to a video website and would like for a banner or a poster to show up while the audio plays, then you can do so using the following command:

ffmpeg -loop 1 -i banner.jpg -i audiofile.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest audio-with-banner.mp4


In the above command, “banner.jpg” is the banner image file, “audiofile.mp3” is the audio file you wish to add a banner to, and the “audio-with-banner.mp4” is the output file that contains your audio plus the banner image.

If your video is lacking subtitles but you have the subtitles’ SRT file on your computer, then you can have it added to the video using the following command:

ffmpeg -i video.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast video-with-subtitles.mkv


The above command will add subtitles to the video file called “video.mp4” from the “subtitles.srt” file and will generate an output file called “video-with-subtitles.mkv.”

With the following commands, you can either increase or decrease the volume in your media file.

To increase the volume, such as to double the current volume, you can use the following command:

ffmpeg -i audio.mp3 -af "volume=2.0" double-volume.mp3


To decrease the volume to half of the current volume, you can use the following command:

ffmpeg -i audio.mp3 -af "volume=0.5" half-volume.mp3


If the orientation of a video is not correct on your computer, then you can have it rotated using the FFmpeg command as follows:

ffmpeg -i video.mp4 -vf transpose=2 rotated.mp4


What you need to focus on here is the value of the “transpose” field. Here are the values that you can use:

  • 0 – for rotating the video 90° counter clockwise and vertical flip
  • 1 – for rotating the video 90° clockwise
  • 2 – for rotating the video 90° counter clockwise
  • 3 – for rotating the video 90° clockwise and vertical flip

If you would like to rotate a video 180°, use transpose=2,transpose=2 in the command, and it should get the job done for you.

FFmpeg is a really powerful tool that you must have on your computer if you happen to play around with media files and often make modifications to them. The tool just makes almost everything possible for you with simple commands.