GIF 가 까다로운 이유
GIF 가 palette 당 256 color 만 지원. Default GIF encoding 이 color 를 naively 픽 + ugly banding 만들어. palettegen + paletteuse two-step 이 clip 별 optimal palette 생성 + 적용 — 차이가 dramatic.
~10 min · gif, palette, share
GIF 가 palette 당 256 color 만 지원. Default GIF encoding 이 color 를 naively 픽 + ugly banding 만들어. palettegen + paletteuse two-step 이 clip 별 optimal palette 생성 + 적용 — 차이가 dramatic.
# Step 1 — optimal palette 생성
ffmpeg -i in.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen=stats_mode=diff" \
-y palette.png
# Step 2 — palette 사용해서 encode
ffmpeg -i in.mp4 -i palette.png \
-lavfi "fps=15,scale=480:-1:flags=lanczos[v];[v][1:v]paletteuse=dither=bayer:bayer_scale=5" \
-y out.gif
# 또는 한 명령에 둘 다
ffmpeg -i in.mp4 \
-vf "fps=15,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5" \
-y one_pass.gif# 00:01:30 시작 5초 clip
ffmpeg -ss 00:01:30 -t 5 -i in.mp4 \
-vf "fps=15,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-y meme.gifffmpeg -i in.mp4 out.gif, (b) palettegen+paletteuse two-pass, (c) 같은 거 + bayer_scale=3. 파일 사이즈 + quality 비교. 그 다음 같은 clip 을 작은 WebP loop 와 MP4 변환 — 그 거 대신 GIF ship 할 때는 언제?아직 댓글이 없어요. 첫 댓글을 남겨보세요.