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