C.W.K.
Stream
Lesson 07 of 08 · published

Complex Filter Examples

~12 min · filter_complex, advanced, production

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Production-quality recipes

The filtergraph patterns most worth memorizing for real work:

  1. Side-by-side comparison — original next to graded.
  2. Picture-in-picture overlay — webcam in screen recording.
  3. Pre-roll + body + post-roll — intro clip + main content + outro.
  4. Watermark + lower-third + audio music — full short-form package.

Code

Pre-roll + main + post-roll (concat with normalize)·bash
# Different sources, same target spec
ffmpeg -i intro.mov -i main.mp4 -i outro.mov \
  -filter_complex "[0:v]scale=1920:1080,fps=30,setsar=1[v0]; \
                   [1:v]scale=1920:1080,fps=30,setsar=1[v1]; \
                   [2:v]scale=1920:1080,fps=30,setsar=1[v2]; \
                   [0:a]aformat=sample_rates=48000:channel_layouts=stereo[a0]; \
                   [1:a]aformat=sample_rates=48000:channel_layouts=stereo[a1]; \
                   [2:a]aformat=sample_rates=48000:channel_layouts=stereo[a2]; \
                   [v0][a0][v1][a1][v2][a2]concat=n=3:v=1:a=1[outv][outa]" \
  -map "[outv]" -map "[outa]" \
  -c:v libx264 -crf 20 -preset slow \
  -c:a aac -b:a 192k \
  -movflags +faststart \
  package.mp4
Full short-form package: PiP + logo + music + lower-third·bash
ffmpeg -i screen.mp4 -i webcam.mp4 -i logo.png -i music.mp3 \
  -filter_complex "[1:v]scale=320:-2[cam]; \
                   [2:v]scale=140:-2[lg]; \
                   [0:v][cam]overlay=W-w-20:H-h-20[withcam]; \
                   [withcam][lg]overlay=20:20[withlogo]; \
                   [withlogo]drawtext=fontfile=/System/Library/Fonts/Supplemental/Arial.ttf:text='Pippa Quest — FFmpeg':fontcolor=white:fontsize=42:x=20:y=H-th-30:box=1:boxcolor=black@0.6:boxborderw=15[outv]; \
                   [3:a]volume=-14dB[bgm]; \
                   [0:a][bgm]amix=inputs=2:duration=first[outa]" \
  -map "[outv]" -map "[outa]" \
  -c:v libx264 -crf 20 -preset slow \
  -c:a aac -b:a 192k \
  -movflags +faststart \
  short.mp4

External links

Exercise

Build the full short-form package recipe with your own assets. Verify each output: PiP visible? Logo top-left? Music ducked under voice? Then strip components one at a time and rebuild — what's the minimal graph that gets you 'shippable'?

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.