FFmpeg examples - hpaluch/hpaluch.github.io GitHub Wiki

FFmpeg examples

FFmpeg is very popular Video and Audio conversion utility. Here I will show few examples I found useful

To simply convert AVI to MP4 with default codec and settings try:

ffmpeg -i video.avi output.mp4

Using deinterlace filter:

  • If your source is interlaced (for example MiniDV camera) you have to deinterlace it, because unlike classic TV today devices can't play it properly
  • it is done with filter - I prefer yadif (Yet Another DeInterlace filter). Please see https://github.com/kfrn/ffmpeg-things/blob/master/deinterlacing.md for discussion on this topic.
ffmpeg -i video.avi -vf yadif output.mp4

Concat and deinterlace

  1. You have to prepare list of files files.txt that looks like:
    file 'input.23-02-11_10-48.00.avi'
    file 'input.23-02-11_11-03.00.avi'
    file 'input.23-02-11_11-18.00.avi'
    
  2. now you have to prepend these two parameters: -f concat -i files.txt to FFmpeg command.

Here is full example - concating input AVI files, deinterlace and produce MP4 on output:

ffmpeg.exe -f concat -i files.txt ^
   -vf yadif output.mp4

Please notice that because of using -f concat demuxer the input is NOT AVI file but text-file with list(!).

Handling Mono input:

Full example:

ffmpeg.exe -f concat -i files.txt ^
   -vf yadif -af "pan=mono|c0=FL" ^
   output.mp4

NOTE: For example contents of files.txt see above text.