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.

1. View File Information

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.

Related: How to Decompile a Video File Into Images with FFMPEG on Linux

2. Simple Conversions Between Formats

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

The same thing works with audio files.

3. Video Targets

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.

4. Converting Video to Audio

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.

5. Convert Video to GIF

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.

6. Creating Clips

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.

7. Scaling Video

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.

8. Add Subtitles to Video

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

Related: How to Screencast From the Command Line in Linux

9. Rotate a Video

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.

10. Set Audio Bitrate

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.

11. Add a Banner to Audio

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.

12. Change the Default Volume of Audio Files

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.

13. Record Audio

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.

Closing Ideas

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.