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. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  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

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

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...

19 Responses

  1. mithil patil says:

    command using ffmpeg for live video streaming ???

  2. pooja thanekar says:

    how to change volume of video or audio file without re-encoding that?

  3. Rakesh Kr Satyam says:

    Very useful.
    Can we change/set codec value of video file without compressing file.

  4. Rakehsh Kr Satyam says:

    Very useful.

  5. shams says:

    How can we compress the output image in ffmpeg. What parameter I need to add to make it.

    eg: ffmpeg -i input.jpg -vf scale=320:240 output_320x240.png I need compressed version of the output image

    • Aaron Kili says:


      Make use of -compression_level especially for PNG output as in the example command above. The compression values range from 0-100 and the default is 100, the highest compression value meaning that it offers the smallest output file size. I hope this will help.

  6. bassel says:

    I have stupid question, if i just need my visitor play video from my website, why use ffmpeg to stream video on my website if i just want display a video

  7. 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 : [email protected]
    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
  8. 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.

  9. 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).

  10. K Raghunathan says:

    Extremely useful. Thanks.

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.