C.W.K.
Stream
Lesson 01 of 10 · published

Filter 문법 — -vf, -af, -filter_complex

~12 min · filtergraph, syntax, vf

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

Flag 세 flavor, 한 언어

  • -vf "…" — default video stream 에 적용된 single video filtergraph. 흔한 케이스의 shorthand.
  • -af "…" — audio 의 같은 idea.
  • -filter_complex "…" — 진짜배기. Multi-input, multi-output, named label. 'video stream 하나만 filter' 이상 뭐든 필요할 때 사용.

문법

Filtergraph 가 comma (sequential) 또는 semicolon (parallel chain) 으로 join 된 filter instance list. 각 filter 가 parameter 를 filter=k1=v1:k2=v2 로. [name] bracket 으로 input/output label.

[0:v]scale=1280:-2[scaled]; [scaled]drawtext=text='Hi':x=10:y=10[outv]

읽기: input 0 의 video 가져와, 1280 wide scale, [scaled] 라고 label; [scaled] 가져와, text 그려, 결과 [outv] label.

Code

단순 → 복잡·bash
# 단순 — default video 에 single filter
ffmpeg -i in.mp4 -vf scale=1280:-2 -c:a copy out.mp4

# Comma 로 chain
ffmpeg -i in.mp4 -vf "scale=1280:-2,format=yuv420p" -c:a copy out.mp4

# -filter_complex 로 multi-stream
ffmpeg -i in.mp4 -i logo.png \
  -filter_complex "[1:v]scale=200:-2[lg]; [0:v][lg]overlay=W-w-20:20[outv]" \
  -map "[outv]" -map 0:a -c:a copy out_with_logo.mp4
Named input 과 -map·bash
# Video 둘, side by side
ffmpeg -i left.mp4 -i right.mp4 \
  -filter_complex "[0:v][1:v]hstack[outv]; [0:a][1:a]amix[outa]" \
  -map "[outv]" -map "[outa]" \
  -c:v libx264 -crf 20 -preset slow \
  side_by_side.mp4

External links

Exercise

Video 와 logo PNG 잡아. 명령 셋 작성: (a) -vf 로 video scale, (b) -filter_complex 로 scale + logo, (c) 같은 video 두 copy side by side. 셋 다 output 재생되는지 확인, ffmpeg -h filter=overlay 로 filtergraph 정확성 검증.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.