ffmpeg recipes

png + audio to mp4

This will produce a square 720x720 video

ffmpeg -y -loop 1 -i IMAGE.png -i AUDIO.ext \
-vf scale=720:720:force_original_aspect_ratio=increase,crop=720:720 \
-shortest -pix_fmt yuv420p -tune stillimage \
-b:a 320K  OUTPUT.mp4

... or instead of defining bitrates for audio and video (-b:v and -b:a) one can use -crf 23

Autopad to 720p:

ffmpeg -y -loop 1 -i IMAGE.png -i AUDIO.ext \
-vf  "scale=-1:720,pad=1280:ih:(ow-iw)/2" \
-shortest -pix_fmt yuv420p -tune stillimage \
-b:a 320K  OUTPUT.mp4

replace audio in a video

ffmpeg -i v.mp4 -i a.wav -c:v copy -map 0:v:0 -map 1:a:0 new.mp4

(source: http://superuser.com/questions/1137612/ddg#1137613)


mp4 -> animated gif

 ffmpeg -i INPUT.mp4 \
 -filter_complex "fps=7,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=64[p];[s1][p]paletteuse=dither=bayer:bayer_scale=1" \
 OUTPUT.gif
 

options fps, max_colors, and dither with bayer_scale will influence the output the most.