Fast Forward MPEG (FFmpeg) is one of the most popular and the best multimedia networks in the world. It offers plenty of tools for you to play the video, convert the formats, stream live broadcast and even analysis the multimedia stream. These are the tools which actually make FFmpeg is a great framework to work with. They provide you with best technical solutions, also offering a myriad of extremely useful yet free software to the users.

FFmpeg can perform many functions when it comes to digitally playing or recording your videos and audios. For instance, you can easily convert the video from one format to another. Following is a very simple example of a command line which converts MP4 file into AVI file.

  # ffmpeg –i  Shawshank_Redemption.mp4  Shawshank_Redemption.avi

 This is the simplest example of any command line you will come across in the FFmpeg. This command will make ffmpeg video converter to convert MP4 file into an file. It is as simple as that. However, it is also recommended to declare other specification such as bitrate and codex as well.

Various Command Lines to Convert Video Formats.

In the context of above discussion, following are some ffmpeg examples of the commands you can use to convert video formats.


.avi and .mpg are two of the most popular video formats. Following commands help you convert .avi video to .mpg.

  # ffmpeg –i original_video.mpg final_vidoe.avi


Conversely, following command will convert an .avi video into an .mpg video.

  # ffmpeg –i – Shawshank_Redemption.avi  Shawshank_Redemption.mpg


.MP4 to .WMV:

The following commands convert .mp4 and .wmv formats between each other.

    # ffmpeg –i  – video_name.mp4  final_video_name.wmv


Now, simply reverse the code to make ffmpeg convert video to mp4. It can’t be simpler than that.

    # ffmpeg –i  – video_name.wmv final_video_name.mp4


.AVI to Uncompressed Animated Gifs:

Sometimes, you also want to convert your videos to animated gifs, especially if you run a blog or online video channel. Following is the Ffmpeg command for converting an .avi video to an uncompressed gif.

    # ffmpeg –i  – original_video.avi gif_uncompressed.gif


.AVI to .FLV:

.flv is another very popular video format. The command line used for converting .avi video format to .flv is slightly different from rest of the commands. Take a look at the following example.

    # ffmpeg –i  – original_video.avi –f flv final_video.flv


.AVI to DV:

DV is a new video format which is quickly garnering popularity among users. Following is a command line you can use to convert .AVI file to a DV file.  

    # ffmpeg –i  – origine.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 video_finale.dv


Converting formats for DVD players:

When it comes to converting videos for DVD players, you need a different line of code. Take a look at the following example.

    # ffmpeg –i  –original_video.avi –target pal-dvd –ps 1000000000 –aspect 16:9 final_video.mpeg


Following is a brief explanation of the above command line.

  • Aspect ratio is 16:9 which is perfect for widescreens.
  • ps 1000000000 is the size of the output file in bites. It is the maximum size for the output video in this particular case.
  • target pal-dvd determines the output format of the video.

In addition to converting video formats between each other, Ffmpeg can also help users to compress different formats between each other. Following is an example of a command line which compresses .AVI to DIVX.

    # ffmpeg –i  –original_video.avi –s 320×240 –vcodec msmpeg4v2 video_output.avi


Similarly you can use following commands to COMPRESS .AVI TO SVCD MPEG2.

PAL format

    # ffmpeg –i  –original_video.avi –target pal-svcd final_video.mpg


NTSC format:

    # ffmpeg –i  –original_video.avi –target ntsc-svcd final_video.mpg


FFmpeg Copy Video Command Line:

Sometimes, it is not a good idea to recode your video. All you need to do is to copy the contents especially when you are editing the video and cutting some of its parts. Following is the command you should use when you want to copy the video instead of recoding it.

    # ffmpeg –i  –origine.mp4 –c:v copy –c:a copy –final.mkv


You can use the same command to copy the video in any format.

Command Line Examples h264:

Ffmpeg also comes with latest x264 encoder which allows you to create high quality H.264 videos quite easily. There are actually two ways you can use x264 encoder to create videos. First of all you need to choose a CRF value and a preset. Subsequently, apply your chosen values in the coder to get the video. This will also help you maintain the quality of all of the future vides you want to encode as well. Take a look at these ffmpeg command line examples h264.

Ffmpeg CRF Example:

    # ffmpeg –i  –input –c:v libx264 –preset fast –crf 22 –c:a copy output.mkv

 FFmpeg Transcode Example:

If you are looking for a more flexible way to use FFmpeg for encoding videos, you must consider using the transcoding feature. You can convert any video and audio format into your specified video codecs and audio output. Following is an example of FFmpeg transcoding.

ffmpeg –i  {filepath/inputfile}.{inputwrapper} –vcodec {desired video codec} –acodec {desired audio codec} {outputfile}.{output wrapper}


The transcode code can look like this in real life.

    # ffmpeg –i  origine.avi –vcodec prores –acodec pcm_s16Ie file.


What this command line is doing that it is converting a standard .avi file to a Quick Time Apple Prores.

FFmpeg Command Line Generators:

You can use many generators or editors to generate command lines for FFmpeg. For instance, FFmpeg Little Helper is a very popular ffmpeg command line generator. Similarly, you can also use Command Line Encoder if you are using windows 10. This particular encoder makes it really simple to generate FFmpeg command lines for windows. There are in fact innumerable command line generates you can use. Just do a little search on Internet and you will get plenty of options to choose from.

Finally, it is also important for you to check the official documentation of FFmpeg if you are new to this multimedia framework. This will help you learn more about FFmpeg and all the amazing things you can do using this extremely popular video converting framework.