15 Useful ‘FFmpeg’ Commands for Video, Audio and Image Conversion in Linux – Part 2

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Computer Science student at Makerere University. Am a Linux enthusiast and a big fan of FOSS. I have used Linux for one year and six months now. I love to share ideas and knowledge around me and in other places around the world.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

7 Responses

  1. Adam says:

    Thanks for sharing.Can you please show me to convert avi video to :(mediainfo) Format : MPEG-4
    Format profile : Base Media / Version 2
    Codec ID : mp42
    File size : 57.7 MiB
    Duration : 21mn 39s
    Overall bit rate mode : Variable
    Overall bit rate : 372 Kbps
    Encoded date : UTC 2016-03-06 07:59:42
    Tagged date : UTC 2016-03-06 07:59:42
    gsst : 0
    gstd : 1299690

    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Baseline@L3.0
    Format settings, CABAC : No
    Format settings, ReFrames : 1 frame
    Format settings, GOP : M=1, N=60
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 21mn 39s
    Bit rate : 274 Kbps
    Maximum bit rate : 698 Kbps
    Width : 640 pixels
    Height : 360 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 25.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.048
    Stream size : 42.5 MiB (74%)
    Tagged date : UTC 2016-03-06 07:59:48

    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 21mn 39s
    Bit rate mode : Variable
    Bit rate : 96.0 Kbps
    Maximum bit rate : 104 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 44.1 KHz
    Compression mode : Lossy
    Stream size : 14.9 MiB (26%)
    Title : IsoMedia File Produced by Google, 5-11-2011
    Encoded date : UTC 2016-03-06 07:59:45
    Tagged date : UTC 2016-03-06 07:59:48

    • Ravi Saive says:


      Try the following ffmpeg command to convert AVI files to MP4 as shown.

      # ffmpeg -i file.avi -vcodec libx264 -vpre lossless_slow -crf 25 -acodec libfaac -threads 0 -t 60 file.mp4
  2. Dennis says:

    Thanks for this follow-up tutorial on FFmpeg. FFmpeg is an excellent, full-featured media toolkit, but its total capabilities can be quite overwhelming. The code examples help with understanding and as a starting point for further exploration.

    Before using FFmpeg, I usually want to know more about the input media file formats I will be using. For this, I usually use FFprobe (one of the useful utility programs included with the FFmpeg suite). FFprobe was created to extract detailed configuration info from a media file. For example:

    $ ffprobe -v quiet -pretty -of default -show_format -show_streams “video.flv” > “video.flv.info”

    FFprobe will produce a nicely formatted report saved to an output file as documentation and for further follow-up analysis. FFprobe can also generate the report in several other print formats (including JSON and XML).

    For repeat usage, I placed the above FFprobe command in a script file, and execute the script passing just the input filename as a parameter. The script handles the rest (including creating the output filename by appending ‘.info’ to the input filename). The double-quotes around the filenames are optional, but are required if the filenames contain spaces. Recommend including double-quotes in the script file to avoid later potential run-time errors.

  3. Hangover Man says:

    There are several errors: 1. hide_banner is a global option, so it should go before -i. 3. “-f image2” is superfluous. 4. You really don’t need any of those other options, and you should have used -ab 192k, not -ab 192. 6. This example does not make an animated GIF at all. 8. -ps does not limit file size; -fs does, but you shouldn’t use it anyway because it will just end when it reaches the specified limit. 10. The input already was MP3, so stream copy would be better (-c:a copy).

  4. K Raghunathan says:

    Extremely useful. Thanks.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?