FFmpeg is very handy utility to edit multimedia file

FFmpeg is very powerful open source multimedia tool. The source code is hosted at https://github.com/FFmpeg/FFmpeg, and the pre-compiled binary version can be found at https://ffmpeg.zeranoe.com/builds/. However, sometimes, it not user friendly, and you have to remember many parameters.

Here are some samples, which I regular used:

Converting video and audio into different format

$ ffmpeg -i input.mp4 output.avi

Compressing video

$ ffmpeg -i input.mp4 -s 640x360 output.mp4

Changing bitrate

$ ffmpeg.exe -i input.avi -b 3000k  -maxrate 4000k -bufsize 1835k output.avi

Concating video

$ ffmpeg.exe -f concat -i filelist.txt -c copy concat.avi


file '1.AVI'   
file '2.AVI'   
file '3.AVI'

Remove audio from video file

$ ffmpeg -i input.mp4 -c copy -an output.mp4

Extract audio from video

$ ffmpeg -i input.avi -vn -acodec copy output.aac

Combining audio into video

$ ffmpeg -i video.mp4 -i audio.m4a -c:v copy -c:a copy output.mp4

Cutting the videos based on start and end time

$ ffmpeg -i input.mp4 -ss 00:00:45 -codec copy -t 40 output.mp4

Adding audio into video file on start and time

$ ffmpeg -i video.mp4 -ss 00:04:00 -i audio.mp3 -c copy -t 40 output.mkv

Adding Poster Image to an Audio File

$ ffmpeg -loop 1 -y -i image.jpg -i audio.mp3 -acodec copy -vcode
c libx264 -shortest ouput.mp4

Download m3u8 url and save as MP4 file

$ ffmpeg -i "http://url/file.m3u8" ouput.mp4

One thought on “FFmpeg is very handy utility to edit multimedia file”

  1. Hi
    Can you help me with the ffmpeg command line.
    I have just put together a command line that output key_frame that I found and it work just as I wanted.
    it display the following format in a text file.

    However before I can save the command line, I lost power to laptop and now I have trouble reconstruct the command line.
    from memory it’s look like this:

    ffmpeg -i file.m2ts frame=key_frame,pkt_pts_time,pict_type (missing option here ) > test.txt

    I don’t know much about command line of ffmpeg as I’m new to it. all I need is for it to list out all the frame like about.

    Thank you much for helping.


Leave a Reply

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