Add background music to a silent video
ffmpeg -filter_complex 'color=color=blue:duration=5s,format=yuv420p' -f lavfi -i 'sine=frequency=440:duration=5' -shortest -map 0:v:0 -map 1:a:0 with-audio.mp4
Extract audio from a video
ffmpeg -i with-audio.mp4 -q:a 0 -map a extracted.mp3
Overlay one video on another (picture-in-picture)
ffmpeg -filter_complex "color=blue:duration=5:size=640x480 [base]; color=red:duration=5:size=160x120 [overlay]; [base][overlay] overlay=W-w-10:H-h-10" pip.mp4
Apply a fade-in effect to audio
ffmpeg -f lavfi -i "sine=frequency=440:duration=10" -af "afade=t=in:st=0:d=3" fadein.wav
Reverse a video clip
ffmpeg -filter_complex "color=yellow:duration=5,drawtext=text=reverse:fontsize=24:x=10:y=H-th-10,reverse" reversed.mp4
Add a watermark image to video
ffmpeg -f lavfi -i "color=white:duration=5:size=640x480" -i logo.png -filter_complex "[0][1]overlay=W-w-10:H-h-10" watermarked.mp4
Speed up a video 2x
ffmpeg -filter_complex "color=gray:duration=5,drawtext=text=fast:fontsize=24:x=10:y=10,setpts=0.5*PTS" fast.mp4
Change audio pitch (chipmunk effect)
ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -af "asetrate=88200,atempo=0.5" chipmunk.wav
Loop an image into a 10-second video
ffmpeg -loop 1 -i static.png -t 10 -vf "format=yuv420p" looped.mp4
Extract every frame from a video as images
ffmpeg -i with-audio.mp4 frame_%03d.png
Apply a fade-out effect to audio
ffmpeg -f lavfi -i "sine=frequency=440:duration=10" -af "afade=t=out:st=7:d=3" fadeout.wav
Create a bouncing ball animation using drawbox
ffmpeg -f lavfi -i "color=black:duration=5:size=320x240" -vf "drawbox=x=mod(t*60\,w-20):y=100:w=20:h=20:color=red@0.8:t=fill" bouncing.mp4
Generate a spectrogram of an audio file
ffmpeg -i fadein.wav -lavfi showspectrumpic=s=1024x512 spectrogram.png
Blur a video (box blur)
ffmpeg -f lavfi -i "color=purple:duration=5:size=640x480" -vf "boxblur=10:1" blur.mp4
Rotate a video 90 degrees clockwise
ffmpeg -f lavfi -i "color=orange:duration=5:size=640x480" -vf "transpose=1" rotated.mp4
Overlay timestamp on video
ffmpeg -f lavfi -i "color=black:duration=10:size=640x480" -vf "drawtext=fontfile=/path/to/font.ttf:text='%{pts\:hms}':fontsize=24:fontcolor=white:x=10:y=10" timestamp.mp4
Note: Replace /path/to/font.ttf with the path to a valid font file on your system.
Create scrolling text video
ffmpeg -f lavfi -i "color=white:duration=10:size=640x100" -vf "drawtext=fontfile=/path/to/font.ttf:text='This is scrolling text':fontsize=24:x='w-mod(t*100\,w+text_w)':y=30:fontcolor=black" scrolling.mp4
Convert a video to grayscale
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480:rate=30" -vf "hue=s=0" grayscale.mp4
Create a side-by-side video from two inputs
ffmpeg -f lavfi -i "color=red:duration=5:size=320x240" -f lavfi -i "color=blue:duration=5:size=320x240" -filter_complex "[0:v][1:v]hstack=inputs=2" sidebyside.mp4
Zoom into the center of a video over time
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480:rate=30" -vf "zoompan=z='min(zoom+0.0015,1.5)':d=125" zoom.mp4
Convert a video segment to GIF
ffmpeg -f lavfi -i "testsrc=duration=3:size=320x240:rate=10" output.gif
Convert a real video to an optimized GIF (2-pass)
ffmpeg -i input.mp4 -vf "fps=15,scale=320:-1:flags=lanczos" -t 3 -y temp.gif
ffmpeg -i temp.gif -filter_complex "[0:v]palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -filter_complex "fps=15,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Apply echo to audio
ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -af "aecho=0.8:0.88:60:0.4" echo.wav
Apply reverb to audio
ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -af "aecho=0.6:0.4:1000:0.5" reverb.wav
Combine video with silent audio
ffmpeg -f lavfi -i "color=gray:duration=5:size=640x480" -f lavfi -i "anullsrc=channel_layout=mono:sample_rate=44100" -shortest -c:v libx264 -c:a aac silent-video.mp4
Crossfade between two audio files
ffmpeg -i sine1.wav -i sine2.wav -filter_complex "[0][1]acrossfade=d=2:c1=tri:c2=tri" crossfade.wav
Note: Requires sine1.wav and sine2.wav to exist and be the same sample rate/channels.
Stack videos vertically
ffmpeg -f lavfi -i "color=red:duration=5:size=320x240" -f lavfi -i "color=blue:duration=5:size=320x240" -filter_complex "[0:v][1:v]vstack=inputs=2" stacked.mp4
Overlay a transparent PNG on a video
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480" -i overlay.png -filter_complex "[0:v][1:v]overlay=10:10" with-overlay.mp4
Add background noise to an audio signal
ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -f lavfi -i "anoisesrc=color=pink:duration=5" -filter_complex "[0][1]amix=inputs=2:duration=first:dropout_transition=2" noisy.wav
Apply a waveform visualization of an audio file to video
ffmpeg -i fadein.wav -filter_complex "showwaves=s=640x240:mode=cline" waveform.mp4
Apply audio ducking (reduce music volume when voice is active)
ffmpeg -i music.wav -i voice.wav -filter_complex "[0:a][1:a]sidechaincompress=threshold=0.05" ducked.wav
Note: music.wav is background music, voice.wav is voiceover.
Replace green screen with background
ffmpeg -i greenscreen.mp4 -i background.jpg -filter_complex "[0:v]colorkey=0x00FF00:0.3:0.1[fg];[1:v][fg]overlay" chroma-key.mp4
Note: Requires greenscreen.mp4 with green background and background.jpg.
Slide transition between two videos
ffmpeg -i red.mp4 -i blue.mp4 -filter_complex "[0:v][1:v]xfade=transition=slideleft:duration=1:offset=4" slidetrans.mp4
Note: Ensure both input videos have same size/codec/duration (~5s).
Create a kaleidoscope effect
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480:rate=30" -vf "geq='lum(X,Y)':128:128,rotate=PI/3,split [a][b]; [a]hflip[a1]; [b]vflip[b1]; [a1][b1]overlay" kaleidoscope.mp4
Capture from webcam (macOS example, AVFoundation)
ffmpeg -f avfoundation -framerate 30 -i "0" -t 5 webcam.mov
Capture from webcam and microphone simultaneously (macOS)
ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -i "0:0" -t 5 capture.mov
Add white noise to a silent video
ffmpeg -f lavfi -i "color=black:duration=5:size=640x480" -f lavfi -i "anoisesrc=color=white:duration=5" -shortest -map 0:v:0 -map 1:a:0 noise-video.mp4
Create looping waveform video of a short audio clip
ffmpeg -i fadein.wav -filter_complex "[0:a]showwaves=s=640x360:mode=line:colors=white,format=yuv420p" -t 5 waveform-loop.mp4
Simulate VHS-style distortion
ffmpeg -f lavfi -i testsrc=duration=5:size=640x480 -vf "hue=s=0,noise=alls=20:allf=t+u" vhs.mp4
Create pulsing zoom effect
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480" -vf "zoompan=z='1+0.5*sin(2*PI*t/1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'" pulsing-zoom.mp4
Apply basic color grading (increase contrast and saturation)
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480" -vf "eq=contrast=1.5:saturation=1.8" graded.mp4
Apply a sepia filter
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480" -vf "colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131" sepia.mp4
Burn hardcoded subtitles into video
ffmpeg -i input.mp4 -vf "subtitles=subs.srt" subtitled.mp4
Note: subs.srt is a UTF-8 encoded subtitle file.
Create subtitles from text manually (no .srt needed)
ffmpeg -f lavfi -i "color=black:duration=5:size=640x480" -vf "drawtext=fontfile=/path/to/font.ttf:text='Hello World':fontsize=32:fontcolor=white:x=(w-text_w)/2:y=h-50" simple-sub.mp4
Live timestamp overlay on webcam (macOS example)
ffmpeg -f avfoundation -i "0" -vf "drawtext=fontfile=/path/to/font.ttf:text='%{localtime}':fontsize=24:fontcolor=white:x=10:y=10" -t 10 timestamped.mov
Animated typewriter text effect
ffmpeg -f lavfi -i "color=black:duration=5:size=640x120" -vf "drawtext=fontfile=/path/to/font.ttf:text='Typewriter effect':fontsize=32:fontcolor=white:x=10:y=50:enable='lt(t,0.5)+lt(t,1.0)+lt(t,1.5)+lt(t,2.0)'" typewriter.mp4
(For full animation, use separate drawtext lines per character or script generation.)
Add soft vignette effect
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480" -vf "vignette" vignette.mp4
Add subtitles with background box
ffmpeg -f lavfi -i "color=black:duration=5:size=640x360" -vf "drawtext=fontfile=/path/to/font.ttf:text='With Background':fontsize=28:fontcolor=white:box=1:boxcolor=black@0.5:x=(w-text_w)/2:y=h-60" boxed-subtitle.mp4
Add scrolling subtitles (ticker style)
ffmpeg -f lavfi -i "color=black:duration=10:size=640x100" -vf "drawtext=fontfile=/path/to/font.ttf:text='This is a scrolling subtitle across the bottom of the screen':fontsize=24:fontcolor=white:x='w-mod(t*100\,w+text_w)':y=h-40" scrolling-sub.mp4
Overlay live input onto a background video (picture-in-picture from webcam)
ffmpeg -f lavfi -i "color=blue:duration=10:size=640x480" -f avfoundation -framerate 30 -video_size 160x120 -i "0" -filter_complex "[0][1]overlay=10:10" live-overlay.mp4
Note: Adjust device index and source name depending on OS — avfoundation is macOS-specific.
Create a meme-style image with top and bottom text
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='TOP TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20:box=1:boxcolor=black@0.6, drawtext=fontfile=/path/to/font.ttf:text='BOTTOM TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=h-text_h-20:box=1:boxcolor=black@0.6" meme.jpg
Meme-style video with top text
ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text='When FFmpeg just works':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20:box=1:boxcolor=black@0.6" meme-top.mp4
Add thick black stroke (outline) around meme text
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='OUTLINED TEXT':fontsize=48:fontcolor=white:borderw=3:bordercolor=black:x=(w-text_w)/2:y=(h-text_h)/2" outlined.jpg
Add emoji or special characters as text
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='That’s hot ':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20" emoji.jpg
Note: Use a font that supports emojis, like Apple Color Emoji or Noto Color Emoji.
Dynamically update text based on timestamp
ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text='Seconds: %{eif\:t\:d}':fontsize=36:fontcolor=white:x=20:y=20:box=1:boxcolor=black@0.5" dynamic-time.mp4
Meme with uppercase impact-style font
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/Impact.ttf:text='TOO MANY FILTERS':fontsize=64:fontcolor=white:borderw=4:bordercolor=black:x=(w-text_w)/2:y=30" impact.jpg
Overlay a meme caption image (e.g. rage face)
ffmpeg -i input.jpg -i face.png -filter_complex "[0][1]overlay=W-w-20:H-h-20" rageface.jpg
Create video meme with top and bottom captions and aspect padding
ffmpeg -i input.mp4 -vf "pad=w=iw:h=ih+160:y=80:color=black, drawtext=fontfile=/path/to/font.ttf:text='TOP TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20, drawtext=fontfile=/path/to/font.ttf:text='BOTTOM TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=h-text_h-20" meme-video.mp4
Animated meme: flashing text effect
ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text='FLASH!':fontsize=64:fontcolor_expr='if(mod(t,0.5)<0.25,white,red)':x=(w-text_w)/2:y=50" flashing.mp4
Meme with vertical split text: two-part reaction
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='Before FFmpeg':fontsize=36:fontcolor=white:x=(w-text_w)/2:y=h/4:borderw=2:bordercolor=black, drawtext=fontfile=/path/to/font.ttf:text='After FFmpeg':fontsize=36:fontcolor=white:x=(w-text_w)/2:y=3*h/4:borderw=2:bordercolor=black" before-after.jpg
Add background music to a silent video
Extract audio from a video
Overlay one video on another (picture-in-picture)
ffmpeg -filter_complex "color=blue:duration=5:size=640x480 [base]; color=red:duration=5:size=160x120 [overlay]; [base][overlay] overlay=W-w-10:H-h-10" pip.mp4Apply a fade-in effect to audio
Reverse a video clip
ffmpeg -filter_complex "color=yellow:duration=5,drawtext=text=reverse:fontsize=24:x=10:y=H-th-10,reverse" reversed.mp4Add a watermark image to video
Speed up a video 2x
ffmpeg -filter_complex "color=gray:duration=5,drawtext=text=fast:fontsize=24:x=10:y=10,setpts=0.5*PTS" fast.mp4Change audio pitch (chipmunk effect)
Loop an image into a 10-second video
ffmpeg -loop 1 -i static.png -t 10 -vf "format=yuv420p" looped.mp4Extract every frame from a video as images
Apply a fade-out effect to audio
Create a bouncing ball animation using drawbox
Generate a spectrogram of an audio file
Blur a video (box blur)
Rotate a video 90 degrees clockwise
Overlay timestamp on video
Note: Replace
/path/to/font.ttfwith the path to a valid font file on your system.Create scrolling text video
Convert a video to grayscale
Create a side-by-side video from two inputs
Zoom into the center of a video over time
Convert a video segment to GIF
ffmpeg -f lavfi -i "testsrc=duration=3:size=320x240:rate=10" output.gifConvert a real video to an optimized GIF (2-pass)
Apply echo to audio
Apply reverb to audio
Combine video with silent audio
Crossfade between two audio files
ffmpeg -i sine1.wav -i sine2.wav -filter_complex "[0][1]acrossfade=d=2:c1=tri:c2=tri" crossfade.wavNote: Requires sine1.wav and sine2.wav to exist and be the same sample rate/channels.
Stack videos vertically
Overlay a transparent PNG on a video
Add background noise to an audio signal
Apply a waveform visualization of an audio file to video
ffmpeg -i fadein.wav -filter_complex "showwaves=s=640x240:mode=cline" waveform.mp4Apply audio ducking (reduce music volume when voice is active)
ffmpeg -i music.wav -i voice.wav -filter_complex "[0:a][1:a]sidechaincompress=threshold=0.05" ducked.wavNote:
music.wavis background music,voice.wavis voiceover.Replace green screen with background
ffmpeg -i greenscreen.mp4 -i background.jpg -filter_complex "[0:v]colorkey=0x00FF00:0.3:0.1[fg];[1:v][fg]overlay" chroma-key.mp4Note: Requires
greenscreen.mp4with green background andbackground.jpg.Slide transition between two videos
ffmpeg -i red.mp4 -i blue.mp4 -filter_complex "[0:v][1:v]xfade=transition=slideleft:duration=1:offset=4" slidetrans.mp4Note: Ensure both input videos have same size/codec/duration (~5s).
Create a kaleidoscope effect
Capture from webcam (macOS example, AVFoundation)
ffmpeg -f avfoundation -framerate 30 -i "0" -t 5 webcam.movCapture from webcam and microphone simultaneously (macOS)
ffmpeg -f avfoundation -video_size 640x480 -framerate 30 -i "0:0" -t 5 capture.movAdd white noise to a silent video
Create looping waveform video of a short audio clip
ffmpeg -i fadein.wav -filter_complex "[0:a]showwaves=s=640x360:mode=line:colors=white,format=yuv420p" -t 5 waveform-loop.mp4Simulate VHS-style distortion
ffmpeg -f lavfi -i testsrc=duration=5:size=640x480 -vf "hue=s=0,noise=alls=20:allf=t+u" vhs.mp4Create pulsing zoom effect
Apply basic color grading (increase contrast and saturation)
Apply a sepia filter
Burn hardcoded subtitles into video
ffmpeg -i input.mp4 -vf "subtitles=subs.srt" subtitled.mp4Note:
subs.srtis a UTF-8 encoded subtitle file.Create subtitles from text manually (no .srt needed)
Live timestamp overlay on webcam (macOS example)
Animated typewriter text effect
(For full animation, use separate
drawtextlines per character or script generation.)Add soft vignette effect
Add subtitles with background box
Add scrolling subtitles (ticker style)
Overlay live input onto a background video (picture-in-picture from webcam)
Note: Adjust device index and source name depending on OS —
avfoundationis macOS-specific.Create a meme-style image with top and bottom text
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='TOP TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20:box=1:boxcolor=black@0.6, drawtext=fontfile=/path/to/font.ttf:text='BOTTOM TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=h-text_h-20:box=1:boxcolor=black@0.6" meme.jpgMeme-style video with top text
ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text='When FFmpeg just works':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20:box=1:boxcolor=black@0.6" meme-top.mp4Add thick black stroke (outline) around meme text
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='OUTLINED TEXT':fontsize=48:fontcolor=white:borderw=3:bordercolor=black:x=(w-text_w)/2:y=(h-text_h)/2" outlined.jpgAdd emoji or special characters as text
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='That’s hot ':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20" emoji.jpgNote: Use a font that supports emojis, like Apple Color Emoji or Noto Color Emoji.
Dynamically update text based on timestamp
ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text='Seconds: %{eif\:t\:d}':fontsize=36:fontcolor=white:x=20:y=20:box=1:boxcolor=black@0.5" dynamic-time.mp4Meme with uppercase impact-style font
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/Impact.ttf:text='TOO MANY FILTERS':fontsize=64:fontcolor=white:borderw=4:bordercolor=black:x=(w-text_w)/2:y=30" impact.jpgOverlay a meme caption image (e.g. rage face)
ffmpeg -i input.jpg -i face.png -filter_complex "[0][1]overlay=W-w-20:H-h-20" rageface.jpgCreate video meme with top and bottom captions and aspect padding
ffmpeg -i input.mp4 -vf "pad=w=iw:h=ih+160:y=80:color=black, drawtext=fontfile=/path/to/font.ttf:text='TOP TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=20, drawtext=fontfile=/path/to/font.ttf:text='BOTTOM TEXT':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=h-text_h-20" meme-video.mp4Animated meme: flashing text effect
ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text='FLASH!':fontsize=64:fontcolor_expr='if(mod(t,0.5)<0.25,white,red)':x=(w-text_w)/2:y=50" flashing.mp4Meme with vertical split text: two-part reaction
ffmpeg -i input.jpg -vf "drawtext=fontfile=/path/to/font.ttf:text='Before FFmpeg':fontsize=36:fontcolor=white:x=(w-text_w)/2:y=h/4:borderw=2:bordercolor=black, drawtext=fontfile=/path/to/font.ttf:text='After FFmpeg':fontsize=36:fontcolor=white:x=(w-text_w)/2:y=3*h/4:borderw=2:bordercolor=black" before-after.jpg