Useful FFMPEG Commands for Managing Audio and Video Files

Managing media isn’t always easy. File formats complicate things further. Many Linux systems employ a powerful tool to both play and manage media: FFMPEG.

FFMPEG is a powerful command-line tool that you can easily use to manage and convert your media files. It can also easily be scripted or incorporated into full programs. Here are some useful FFMPEG commands that will help you get the most from it.

FFMPEG has access to all  of the information about the files that you’re working with. You can display that information in the terminal without modifying the file or running a conversion.

Despite its power, FFMPEG is really simple to use. You can easily convert a file between formats with a single command.

FFMPEG Convert Video

The same thing works with audio files.

Convert Audio FFMEPG

For videos, FFMPEG also includes a feature that attempts to match the specifications of a medium for output. It’s mostly used for formatting a video to be burned to a DVD.

You can specify regions, too.

If you have a video with a song that you’d like or possibly only need the audio portion of a video file, you can use FFMPEG to strip video from a file, leaving only the audio.

If you’re a fan of creating memes out of short animated .gifs, you’re in luck.  FFMPEG can convert a video file to a GIF.  Combine this with the next section on creating clips to isolate the exact piece of the video that you want.

You can create video and audio clips with FFMPEG, too. You only need to specify a start point and how long you want FFMPEG to run for. The -ss flag will give you a start point. Give it the time in hh:mm:ss. The same is true for the -f flag that will specify the run time of the clip. At the end, the -c flag tells FFMPEG to create a copy from the original instead of cutting down the same file.

FFMPEG can also scale down video to different resolutions to reduce size and/or fit different screens.  Specify the dimensions that you want, and it’ll automatically scale when you convert.

If you have a video file and the accompanying subtitles separate, you can add in the subtitles with FFMPEG.

You can actually change the rotation of a video. This is useful for when you want to format a video for mobile devices. There are several options you can use to change the direction of the rotation. 0 is for a counter-clockwise rotation and a vertical flip. 1 is for a 90-degree rotation clockwise. 2 rotates the video 90 degrees counter-clockwise. 3 will rotate the video 90 degrees clockwise and flip it vertically.

When you’re converting audio files, it’s often important to set the bitrate of the resulting file. The bitrate will help improve the quality of the audio. To specify the bitrate, use the -ab flag.

If you’re creating an audio file to upload to a video site, you can add one in to turn the audio into a video file with a static image.

Sometimes you have an audio file that’s just too quiet to hear, or worse, one that’s obnoxiously loud.  You can use FFMPEG to change the default volume of an audio file.  It considers 1 to be the default volume, so 2 would be double the original, and 0.5 would be half.

You can also use FFMPEG to record audio directly from an input source, like a microphone. It works very similarly to anything else, but you need to specify which audio backend (alsa or pulseaudio) you’re using. You also need to specify a device (the microphone) as the source instead of a file.


There is a lot more you can do with FFMPEG, actually, and once you get into scripting, you’ll find many more possibilities. Start combining these options, too, and you’ll find that you can gain quite a bit of control over your media files.

This article was first published on September 2016 and was updated in February 2018.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.