- img sequence to mp4
ffmpeg -framerate <fps> -pattern_type glob -i "*.jpg" -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4
where 24 is the desired fps
- mov to mp4
ffmpeg -i input.mov -vcodec h264 -acodec mp2 output.mp4
-
mp4 to gif
ffmpeg -i input.mp4 -f gif output.gif
-
scale width/height with ratio
ffmpeg -i input.mp4 -vf scale=<width>:-1 output.mp4
- remove audio
Add -an
flag
- remove video
Add -vn
flag & -acodec copy
to keep same audio codec
- resample audio
-q:a 0
out.mp3 will output VBR
- speed up video
-itsscale 0.2
where 0.2 is 5x speedup (1/5) (to be put before -i
option)
- crop video
ffmpeg -i input.mp4 -filter:v "crop=<width>:<height>:<x>:<y>" out.mp4
- concat mov/mp4 files (can fail with audio - better to mute files first with -an)
touch files.txt
echo file file1.mov >> files.txt
echo file file[n].mov >> files.txt
...
ffmpeg -f concat -i files.txt -c copy output.mov
rm files.txt
- replace audio track with external file
ffmpeg -i input.mp4 -i audio.mp3 -map 0:v -map 1:a -c:v copy -shortest output.mp4