Skip to content

Instantly share code, notes, and snippets.

@ratbeard
Created May 14, 2013 18:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ratbeard/5578236 to your computer and use it in GitHub Desktop.
Save ratbeard/5578236 to your computer and use it in GitHub Desktop.
# Install with:
# brew install ffmpeg --HEAD --with-freetype --with--ffplay
# http://www.ffmpeg.org/ffmpeg-filters.html#overlay
# Make a blank video
#ffmpeg -y -filter_complex "color=black:s=960x960:d=6" blank-960x960-6s.mp4
#ffmpeg -y -filter_complex "color=white:s=960x960:d=6" blank-white-960x960-6s.mp4
#
# Another way to make backgrounds
#ffmpeg -y -f lavfi -t 1 -i "color=c=orange" mandelbrot.mp4
#
#
# Mandelbrot video. The -pix_fmt is needed to play back in quicktime.
#ffmpeg -y -f lavfi -t 20 -an -i mandelbrot -pix_fmt yuv420p mandelbrot.mp4
#
# Life video.
#ffmpeg -y -f lavfi -t 4 -i life=s=640x480:mold=10:r=100:ratio=0.1:death_color=blue:life_color=#00ff00,boxblur=2:2 -pix_fmt yuv420p life.mp4
# Cellular automaton video.
ffmpeg -y -f lavfi -t 100 -i cellauto=rule=110 -pix_fmt yuv420p cell.mp4
# Overlay snow on top of computer. 2 seconds in to clip:
#ffmpeg -y -i pc2.mp4 -itsoffset 2 -i snow.mp4 -filter_complex "[1]scale=259:150[insert]; [0][insert]overlay=enable='between(t,2,5.07)':x=116:y=143" overlay.mp4
# Combine into 4 pieces
#ffmpeg -y -i whoo.mp4 -i pc.mp4 -i snow.mp4 -i pc2.mp4 -filter_complex "color=green:s=960x960:d=6[bg]; [0]pad=0[tl]; [1]pad=0[tr]; [2]pad=0[bl]; [3]pad=0[br]; [bg][tr]overlay[o1]; [o1][tl]overlay=w[o2]; [o2][bl]overlay=0:h[o3]; [o3][br]overlay=w:h" four.mp4
# Combine into 4 pieces with wicked effects
#ffmpeg -y -i snow.mp4 -i pc.mp4 -i whoo.mp4 -i pc2.mp4 -filter_complex "color=green:s=960x960:d=6[bg]; [0]negate [tl]; [1]hue='H=2*PI*t: s=sin(2*PI*t)+1'[tr]; [2]noise=alls=50:allf=t+u[bl]; [3]vflip,fade=t=in:st=0.5:d=2,fade=t=out:st=5:d=1[br]; [bg][tr]overlay[o1]; [o1][tl]overlay=w[o2]; [o2][bl]overlay=0:h[o3]; [o3][br]overlay=w:h" four_fx.mp4
# Move a screenshot across the screen, with a fade in/out
#ffmpeg -y -i blank-960x960-6s.mp4 -i cnn.png -filter_complex "[0]null[bg]; [1]null[pic]; [bg][pic]overlay=x=W/2-w/2:y=H-t*100, fade=t=in:st=0.3:d=1, fade=t=out:st=5:d=1" screenshot.mp4
#ffmpeg -y -i blank-white-960x960-6s.mp4 -vf "
#drawtext=fontfile='/Library/fonts/MyriadWebPro.ttf':text='smap':fontsize=205:fontcolor=0x00000077:x=90+rand(1\,2*t*t+5):y=50+rand(1\,2*t*t+5):box=1:boxcolor=0xff000033,
#drawtext=fontfile='/Library/fonts/LetterGothicStd.otf':text='Destroy Convention':fontsize=50:fontcolor=0xff0000ff:shadowcolor=0xff000077:shadowx=5:shadowy=5:x=-450+120*t:y=h/2+t*20,
#drawtext=fontfile='/Library/fonts/RosewoodStd-Regular.otf':text='Create Demand':fontsize=80:fontcolor=black:y=h-170:x=80:draw=lt(mod(t*1.25\,2)\,1)
#" text.mp4
# Draw text
#ffmpeg -y -t 10 -s qcif -f rawvideo -pix_fmt rgb24 -s 1280x720 -i /dev/zero -g 1 -r 24 -vf drawtext="fontfile=/Library/fonts/MyriadWebPro.ttf:text='Oh hai':fontsize=150:fontcolor=red:y=h-40*t" wow.mpg
#
# Concat together several vids (must be same codec and size)
#ffmpeg -y -f concat -i long.txt -c copy long.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment