-
Notifications
You must be signed in to change notification settings - Fork 8
FFmpeg examples
Henryk Paluch edited this page Feb 19, 2023
·
2 revisions
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
- I use great
WinDV
from https://www.videohelp.com/software/WinDV to capture video from MiniDV camera to PC over FireWire. This tool splits video files on every scene and over specified number of frames (22500 frames = 15minutes in PAL format - 25fps). - here is FFmpeg a bit confusing, because there are two
concat
blocks and we use so calledconcat
demuxer, see https://trac.ffmpeg.org/wiki/Concatenate#demuxer.
- 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'
- 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:
- when capturing video it is often in mono format
- in my case only left audio channel has sound
- you have to use this audio-filter:
-af "pan=mono|c0=FL"
from https://superuser.com/questions/1063185/how-to-select-the-left-audio-channel-with-ffmpeg-and-downmix-to-mono - to convert stereo with left channel to mono
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.
Copyright © Henryk Paluch. All rights reserved.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License