Communitygithub.com

FFmpeg 비디오 프로덕션

FFmpeg를 사용한 비디오 및 오디오 처리. 포맷 변환, 크기 조정, 압축, 오디오 추출 및 Remotion 에셋 준비에 사용됩니다. GIF를 MP4로 변환, 비디오 크기 조정, 오디오 추출, 파일 압축 등 모든 미디어 변환 작업을 트리거합니다.

FFmpeg 비디오 프로덕션란 무엇인가요?

이 스킬은 비디오/오디오 처리의 핵심 도구인 FFmpeg를 활용하여 Remotion 비디오 프로젝트에 최적화된 작업을 수행합니다. GIF를 MP4로 변환, 비디오 리사이즈, 압축, 오디오 추출, 트리밍, 속도 조절, 영상 연결, 페이드 인/아웃 등 다양한 미디어 변환 명령어를 제공합니다. 특히 Remotion과의 통합을 고려하여 `playbackRate` 속성의 한계를 극복하는 FFmpeg 전처리 패턴과 데모 녹화물 준비 방법을 상세히 다룹니다. 또한 YouTube, Twitter/X, LinkedIn, 웹사이트 등 각 플랫폼별 출력 최적화 설정을 제공하여, Remotion 렌더링 후 플랫폼에 맞게 비디오를 빠르게 변환할 수 있도록 합니다. 스킬 마크다운에는 빠른 참조 명령어, 품질 가이드라인, 플랫폼 요구사항 표, 배치 내보내기 스크립트, 오류 처리 방법이 모두 포함되어 있어 개발자와 AI 에이전트가 즉시 생산적으로 사용할 수 있습니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Zuhair-01/claude-skills-and-systems/tree/HEAD/skills/ffmpeg

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

FFmpeg 비디오 프로덕션은(는) 무엇을 하나요?

FFmpeg은 비디오/오디오 처리를 위한 필수 도구입니다. 이 스킬은 Remotion 비디오 프로젝트를 위한 일반적인 작업을 다룹니다.

빠른 참조

GIF를 MP4로 변환 (Remotion 호환)

ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p \
  -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4

이 플래그를 사용하는 이유:

  • -movflags faststart - 웹 스트리밍을 위해 메타데이터를 시작 부분으로 이동
  • -pix_fmt yuv420p - 대부분의 플레이어와 호환성 보장
  • scale=trunc(...) - 짝수 크기 강제 (대부분의 코덱에서 필요)

비디오 크기 조정

# 1920x1080으로 (종횡비 유지, 검은 막대 추가)
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" output.mp4

# 1920x1080으로 (채우기 위해 크롭)
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" output.mp4

# 너비 기준 크기 조정, 높이는 자동
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4

비디오 압축

# 좋은 품질, 작은 파일 (CRF 23이 기본, 낮을수록 좋은 품질)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4

# 웹 미리보기를 위한 강력한 압축
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset fast -c:a aac -b:a 96k output.mp4

# 특정 파일 크기 목표 (예: 60초 비디오 ~10MB = ~1.3Mbps)
ffmpeg -i input.mp4 -c:v libx264 -b:v 1300k -c:a aac -b:a 128k output.mp4

오디오 추출

# MP3로 추출
ffmpeg -i input.mp4 -vn -acodec libmp3lame -q:a 2 output.mp3

# AAC로 추출
ffmpeg -i input.mp4 -vn -acodec aac -b:a 192k output.m4a

# WAV로 추출 (무손실)
ffmpeg -i input.mp4 -vn output.wav

오디오 형식 변환

# M4A를 MP3로 (ElevenLabs 음성 샘플용)
ffmpeg -i input.m4a -codec:a libmp3lame -qscale:a 2 output.mp3

# WAV를 MP3로
ffmpeg -i input.wav -codec:a libmp3lame -b:a 192k output.mp3

# 볼륨 조절
ffmpeg -i input.mp3 -filter:a "volume=1.5" output.mp3

비디오 트리밍/자르기

# 타임스탬프부터 길이만큼 자르기 (권장 - 신뢰성 높음)
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:15 -c:v libx264 -c:a aac output.mp4

# 타임스탬프부터 타임스탬프까지 자르기
ffmpeg -i input.mp4 -ss 00:00:30 -to 00:00:45 -c:v libx264 -c:a aac output.mp4

# 스트림 복사 (더 빠르지만 컷 포인트에서 프레임 손실 가능)
# 원본에 키프레임이 자주 있는 경우에만 사용
ffmpeg -i input.mp4 -ss 00:00:30 -t 00:00:15 -c copy output.mp4

참고: 트리밍 시에는 재인코딩을 권장합니다. 스트림 복사(-c copy)는 탐색 지점이 키프레임과 일치하지 않으면 비디오를 조용히 드롭할 수 있습니다.

속도 올리기 / 느리게 하기

# 2배속 (비디오 및 오디오)
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4

# 0.5배속 (슬로우 모션)
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4

# 비디오만 (오디오 없음)
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -an output.mp4

비디오 연결

# 파일 목록 생성
echo "file 'clip1.mp4'" > list.txt
echo "file 'clip2.mp4'" >> list.txt
echo "file 'clip3.mp4'" >> list.txt

# 연결 (동일 코덱/해상도)
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

# 재인코딩하여 연결 (다른 소스)
ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -c:a aac output.mp4

페이드 인/아웃 추가

# 처음 1초 페이드 인, 마지막 1초 페이드 아웃 (30fps 비디오)
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1" -c:a copy output.mp4

# 오디오 페이드
ffmpeg -i input.mp4 -af "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1" -c:v copy output.mp4

비디오 정보 얻기

# 길이, 해상도, 코덱 정보
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4

# 전체 정보
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

Remotion 관련 패턴

Remotion용 비디오 속도 조정

FFmpeg 사용 시점 vs Remotion playbackRate 사용 시점:

시나리오FFmpeg 사용Remotion 사용
일정한 속도 (1.5배, 2배)둘 다 가능✅ 더 간단
극한 속도 (>4배 또는 <0.25배)✅ 더 안정적문제 발생 가능
가변 속도 (시간에 따라 가속)✅ 사전 처리복잡한 우회 방법 필요
완벽한 오디오 동기화 필요✅ 보장됨대부분 괜찮음
데모가 보이스오버 타이밍에 맞춰야 함✅ 사전 계산런타임 조정

Remotion 제한: playbackRate는 일정해야 합니다. playbackRate={interpolate(frame, [0, 100], [1, 5])}와 같은 동적 보간은 Remotion이 독립적으로 프레임을 평가하기 때문에 올바르게 작동하지 않습니다.

# 데모 속도를 높여 씬에 맞추기 (예: 60초 데모를 20초로 = 3배속)
ffmpeg -i demo-raw.mp4 \
  -filter_complex "[0:v]setpts=0.333*PTS[v];[0:a]atempo=3.0[a]" \
  -map "[v]" -map "[a]" \
  public/demos/demo-fast.mp4

# 강조를 위한 슬로우 모션 (0.5배속)
ffmpeg -i action.mp4 \
  -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" \
  -map "[v]" -map "[a]" \
  public/demos/action-slow.mp4

# 오디오 없이 속도 높이기 (화면 녹화에 일반적)
ffmpeg -i demo.mp4 -filter:v "setpts=0.5*PTS" -an public/demos/demo-2x.mp4

# 타임랩스 효과 (10배속, 오디오 제거)
ffmpeg -i long-demo.mp4 -filter:v "setpts=0.1*PTS" -an public/demos/timelapse.mp4

속도 계수 계산:

  • X초의 비디오를 Y초의 씬에 맞추려면: speed = X / Y
  • setpts 승수 = 1 / speed (예: 3배속 = setpts=0.333*PTS)
  • atempo 값 = speed (예: 3배속 = atempo=3.0)

극한 속도 (>2배 오디오): atempo 필터 체인 연결 (각각 0.5-2.0 범위로 제한됨):

# 4배속 오디오
-filter_complex "[0:a]atempo=2.0,atempo=2.0[a]"

# 8배속 오디오
-filter_complex "[0:a]atempo=2.0,atempo=2.0,atempo=2.0[a]"

Remotion용 데모 녹화물 준비

# 표준 1080p, 30fps, Remotion 준비 완료
ffmpeg -i raw-recording.mp4 \
  -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,fps=30" \
  -c:v libx264 -crf 18 -preset slow \
  -c:a aac -b:a 192k \
  -movflags faststart \
  public/demos/demo.mp4

화면 녹화를 Remotion 에셋으로

# iPhone/iPad 녹화에서 (보통 60fps, 가변 해상도)
ffmpeg -i iphone-recording.mov \
  -vf "scale=1920:-2,fps=30" \
  -c:v libx264 -crf 20 \
  -an \
  public/demos/mobile-demo.mp4

GIF 일괄 변환

for f in assets/*.gif; do
  ffmpeg -i "$f" -movflags faststart -pix_fmt yuv420p \
    -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
    "public/demos/$(basename "$f" .gif).mp4"
done

일반적인 문제

"높이가 2로 나누어지지 않음"

스케일 필터 추가: -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"

비디오가 브라우저에서 재생되지 않음

사용: -movflags faststart -pix_fmt yuv420p -c:v libx264

속도 변경 후 오디오 싱크 맞지 않음

atempo와 함께 filter_complex 사용: -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]"

파일이 너무 큼

CRF 증가 (23→28) 또는 해상도 감소

품질 가이드라인

사용 사례CRF프리셋참고
보관/마스터18slow최고 품질, 큰 파일
프로덕션20-22medium좋은 균형
웹/미리보기23-25fast작은 파일
초안/빠른 작업28+veryfast빠른 인코딩

플랫폼별 출력 최적화

Remotion이 비디오를 렌더링한 후(일반적으로 out/video.mp4), FFmpeg를 사용하여 각 배포 플랫폼에 맞게 최적화합니다.

워크플로우 통합

Remotion 렌더링 (마스터)     FFmpeg 최적화            플랫폼 업로드
       ↓                            ↓                       ↓
   out/video.mp4  ────────→  out/video-youtube.mp4  ───→  YouTube
                  ────────→  out/video-twitter.mp4  ───→  Twitter/X
                  ────────→  out/video-linkedin.mp4 ───→  LinkedIn
                  ────────→  out/video-web.mp4      ───→  웹사이트 임베드

YouTube (권장 설정)

YouTube는 모든 것을 재인코딩하므로 고품질로 업로드하세요:

# YouTube 최적화 (1080p)
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset slow -crf 18 \
  -profile:v high -level 4.0 \
  -bf 2 -g 30 \
  -c:a aac -b:a 192k -ar 48000 \
  -movflags +faststart \
  out/video-youtube.mp4

# YouTube Shorts (세로 1080x1920)
ffmpeg -i out/video.mp4 \
  -vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2" \
  -c:v libx264 -crf 18 -c:a aac -b:a 192k \
  out/video-shorts.mp4

Twitter/X

Twitter는 엄격한 제한이 있습니다: 최대 140초, 512MB, 1920x1200:

# Twitter 최적화 (빠른 업로드를 위해 15MB 미만 목표)
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset medium -crf 24 \
  -profile:v main -level 3.1 \
  -vf "scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease" \
  -c:a aac -b:a 128k -ar 44100 \
  -movflags +faststart \
  -fs 15M \
  out/video-twitter.mp4

# 파일 크기 및 길이 확인
ffprobe -v error -show_entries format=duration,size -of csv=p=0 out/video-twitter.mp4

LinkedIn

LinkedIn은 AAC 오디오가 포함된 MP4를 선호하며, 최대 10분:

# LinkedIn 최적화
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset medium -crf 22 \
  -profile:v main \
  -vf "scale='min(1920,iw)':'min(1080,ih)':force_original_aspect_ratio=decrease" \
  -c:a aac -b:a 192k -ar 48000 \
  -movflags +faststart \
  out/video-linkedin.mp4

웹사이트/임베드 (빠른 로딩에 최적화)

# 웹 최적화 MP4 (작은 파일, 점진적 로딩)
ffmpeg -i out/video.mp4 \
  -c:v libx264 -preset medium -crf 26 \
  -profile:v baseline -level 3.0 \
  -vf "scale=1280:720" \
  -c:a aac -b:a 128k \
  -movflags +faststart \
  out/video-web.mp4

# WebM 대안 (더 나은 압축, 더 넓은 브라우저 지원)
ffmpeg -i out/video.mp4 \
  -c:v libvpx-vp9 -crf 30 -b:v 0 \
  -vf "scale=1280:720" \
  -c:a libopus -b:a 128k \
  -deadline good \
  out/video-web.webm

GIF (미리보기/썸네일용)

# 고품질 GIF (처음 5초)
ffmpeg -i out/video.mp4 -t 5 \
  -vf "fps=15,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
  out/preview.gif

# 더 작은 파일 GIF
ffmpeg -i out/video.mp4 -t 3 \
  -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
  out/preview-small.gif

플랫폼 요구사항 빠른 참조

플랫폼최대 해상도최대 크기최대 길이오디오
YouTube8K256GB12시간AAC 48kHz
Twitter/X1920x1200512MB140초AAC 44.1kHz
LinkedIn4096x23045GB10분AAC 48kHz
Instagram 피드1080x13504GB60초AAC 48kHz
Instagram Reels1080x19204GB90초AAC 48kHz
TikTok1080x1920287MB10분AAC

모든 플랫폼을 위한 일괄 내보내기

#!/bin/bash
# export-all-platforms.sh로 저장
INPUT="out/video.mp4"

# YouTube (고품질)
ffmpeg -i "$INPUT" -c:v libx264 -preset slow -crf 18 \
  -c:a aac -b:a 192k -movflags +faststart \
  out/video-youtube.mp4

# Twitter (압축됨)
ffmpeg -i "$INPUT" -c:v libx264 -crf 24 \
  -vf "scale='min(1280,iw)':'-2'" \
  -c:a aac -b:a 128k -movflags +faststart \
  out/video-twitter.mp4

# LinkedIn
ffmpeg -i "$INPUT" -c:v libx264 -crf 22 \
  -c:a aac -b:a 192k -movflags +faststart \
  out/video-linkedin.mp4

# 웹 임베드 (작게)
ffmpeg -i "$INPUT" -c:v libx264 -crf 26 \
  -vf "scale=1280:720" \
  -c:a aac -b:a 128k -movflags +faststart \
  out/video-web.mp4

echo "내보내기 완료:"
ls -lh out/video-*.mp4

오류 처리

비디오 처리 시 일반적인 오류와 해결 방법:

# FFmpeg 성공 여부 확인
ffmpeg -i input.mp4 -c:v libx264 output.mp4 && echo "성공" || echo "실패: 입력 파일 확인"

# 출력 파일 재생 가능 여부 확인
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of csv=p=0 output.mp4

# 자세한 오류 정보 얻기
ffmpeg -v error -i input.mp4 -f null - 2>&1 | head -20

일반적인 실패 처리

오류원인해결 방법
"No such file"입력 경로 오류경로 확인, 공백은 따옴표 사용
"Invalid data"손상된 입력소스 다시 다운로드 또는 재녹화
"height not divisible by 2"홀수 크기trunc가 포함된 스케일 필터 추가
"encoder not found"코덱 누락전체 코덱이 포함된 FFmpeg 설치
출력 0바이트자동 실패오류에 대한 전체 ffmpeg 출력 확인

피드백 및 기여

이 스킬에 누락된 정보가 있거나 개선될 수 있는 경우:

  • 명령어가 누락되었습니까? 필요한 것을 설명해 주세요.
  • 오류를 발견하셨습니까? 무엇이 잘못되었는지 알려주세요.
  • 기여하고 싶으십니까? 다음을 도와드릴 수 있습니다:
    1. 이 스킬을 개선 사항으로 업데이트
    2. github.com/digitalsamba/claude-code-video-toolkit에 PR 생성

"이 스킬 개선"이라고 말씀하시면 .claude/skills/ffmpeg/SKILL.md 업데이트를 안내해 드리겠습니다.

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

Zuhair-01/claude-skills-and-systems

Create AI avatar videos with precise control over avatars, voices, scripts, scenes, and backgrounds using HeyGen's v2 API. Use when: (1) Choosing a specific avatar and voice for a video, (2) Writing exact scripts for an avatar to speak, (3) Building multi-scene videos with different backgrounds per scene, (4) Creating transparent WebM videos for compositing, (5) Using talking photos as video presenters, (6) Integrating HeyGen avatars with Remotion, (7) Batch video generation with exact specs, (8) Brand-consistent production videos with precise control.

Zuhair-01/claude-skills-and-systems

Generate Mandarin and multilingual narration with Volcengine Doubao Speech 2.0. Use when creating Chinese voiceovers, when the user prefers Doubao/Volcengine/火山引擎/豆包 TTS, or when narration needs character-level timestamp metadata for subtitles.

Zuhair-01/claude-skills-and-systems

Edit existing videos using AI — remix style, upscale, remove background, and add audio via fal.ai's hosted video models.

Zuhair-01/claude-skills-and-systems

Author or edit a custom HyperFrames composition when no specialized workflow fits, or when BRIEF.md sets flow: companion. Use for longer or multi-scene pieces, brand and sizzle reels, montages, static loops, static title cards, footage remixes, and freeform builds. Use motion-graphics instead for a short unnarrated motion-first unit, including an animated title. Route fresh creation through hyperframes before using this skill.

Zuhair-01/claude-skills-and-systems

Read-only queue dashboard for workspace-aware ship. (gstack)

Zuhair-01/claude-skills-and-systems

Generate HeyGen presenter videos via the v3 Video Agent pipeline — handles Frame Check (aspect ratio correction), prompt engineering, avatar resolution, and voice selection. Required for any HeyGen video generation. Replaces deprecated endpoints with v3. Use when: (1) generating any HeyGen video (via API or otherwise), (2) sending a personalized video message (outreach, update, announcement, pitch, knowledge), (3) creating a HeyGen presenter-led explainer, tutorial, or product demo with a human face, (4) "make a video of me saying...", "send a video to my leads", "record an update for my team", "create a video pitch", "make a loom-style message", "I want to appear in this video", "generate a HeyGen video", "make a talking head video". Accepts avatar_id from heygen-avatar for identity-first HeyGen videos, or uses a stock presenter. Returns video share URL + HeyGen session URL for iteration. Chain signal: when the user wants to create/design an avatar AND make a video in the same request, run heygen-avatar f...

Zuhair-01/claude-skills-and-systems

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

Zuhair-01/claude-skills-and-systems

The HyperFrames composition contract — build one renderable project. Use for composition structure, the `data-*` timing attributes, `class="clip"`, tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Zuhair-01/claude-skills-and-systems

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

관련 스킬