Command | Description |
---|---|
ffmpeg -i in.mp4 out.avi |
Convert from one format to another |
ffmpeg -i in.mp4 -preset slower -crf 18 out.mp4 |
Convert with custom quality: lower crf = higher quality (range: 0-51) |
ffmpeg -i in.mkv -c:v copy -c:a copy out.mp4 |
Remux MKV file into MP4 (no quality loss) |
ffmpeg -i onlyvideo.mp4 -i onlyaudio.mp4 -c copy -map 0:0 -map 1:1 -shortest out.mp4 |
Mux video and audio from different videos (no quality loss) |
ffmpeg -i in.mp4 -vf scale=640:480 out.mp4 |
Resize video to 640 x 480 |
ffmpeg -i in.mp4 -vf "transpose=1" out.mp4 |
Rotate video 90 degrees clockwise (range: 0-3) |
ffmpeg -i in.mp4 -vf "transpose=2,transpose=2" out.mp4 |
Rotate video 180 degrees |
ffmpeg -i in.mp4 out%04d.jpg -hide_banner |
Extract all frames |
ffmpeg -i in.mp4 -ss 00:00:10.000 -vframes 1 out.jpg |
Extract only one frame |
ffmpeg -i in.mp4 -fps=1 -vsync 0 out%d.png |
Extract one frame per second |
ffmpeg -i in.mp4 -vf select='between(t,1,5)+between(t,11,15)' -vsync 0 out%d.png |
Extract frames between 1-5 seconds & 11-15 seconds |
ffmpeg -i in.mp4 -vf yadif out.mp4 |
Deinterlace |
Source: https://gist.github.com/peterdalle/27d370fa457e6ec7ba85fb34cf2e6768