Communitygithub.com

FFmpeg

FFmpeg은 오디오 및 비디오 처리를 위한 최고의 도구로, 거의 모든 포맷, 코덱, 컨테이너를 지원합니다. 이 스킬은 포맷 변환, 코덱 트랜스코딩, 트리밍, 연결, 필터링, 압축, 썸네일 추출, 자막 삽입, 오디오 정규화, GIF 생성, 워터마킹 및 yt-dlp, gallery-dl과의 파이프라인 통합을 다룹니다.

FFmpeg란 무엇인가요?

FFmpeg 스킬은 미디어 처리를 위한 포괄적인 명령어 모음집으로, 개발자와 AI 에이전트가 오디오/비디오 파일을 쉽게 조작할 수 있도록 설계되었습니다. 이 스킬은 Ubuntu/Debian, macOS 등 다양한 플랫폼에서 설치 방법을 제공하며, WebM을 MP4로 변환하는 기본 포맷 변환부터 오디오 추출, 트리밍, 해상도 변경, 압축, 썸네일 생성, 자막 삽입, GIF 제작, 워터마킹, 속도 조절, 필터 적용 등 10단계의 상세한 명령어를 포함합니다. 각 명령어는 실제 사용 예시와 함께 설명되어 있어, 복잡한 미디어 작업을 단순화합니다. 특히 yt-dlp로 다운로드한 WebM 파일을 iPhone 호환 MP4로 변환하거나 여러 클립을 페이드 전환으로 연결하는 하이라이트 릴 제작 같은 실제 시나리오를 예제로 제공하여, AI 에이전트가 사용자 요청을 이해하고 적절한 명령어를 실행할 수 있도록 돕습니다. 또한 CRF 품질 설정, 스트림 복사 최적화, 배치 처리 팁 등 전문가 수준의 가이드라인을 포함하여 효율적이고 정확한 미디어 처리를 지원합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/TerminalSkills/skills/ffmpeg

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

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

문서

FFmpeg은(는) 무엇을 하나요?

개요

FFmpeg은 미디어 처리의 스위스 군용 칼입니다. 존재하는 거의 모든 오디오 및 비디오 포맷, 코덱, 컨테이너를 처리합니다. 이 스킬은 포맷 변환, 코덱 트랜스코딩, 트리밍, 연결, 필터링, 압축, 썸네일 추출, 자막 삽입, 오디오 정규화, GIF 생성, 워터마킹 및 yt-dlp, gallery-dl과 같은 도구와의 파이프라인 통합을 다룹니다.

지침

1단계: 설치

# Ubuntu/Debian
sudo apt install -y ffmpeg

# macOS
brew install ffmpeg

# 확인
ffmpeg -version
ffprobe -version   # 미디어 정보 도구, ffmpeg에 포함됨

2단계: 포맷 변환

가장 일반적인 작업 — 컨테이너 포맷과 코덱 간 변환입니다.

# WebM → MP4 (H.264 + AAC로 재인코딩, 범용 호환성)
ffmpeg -i input.webm -c:v libx264 -c:a aac -movflags +faststart output.mp4

# WebM → MP4 (이미 H.264/AAC인 경우 스트림 복사 — 즉시, 품질 손실 없음)
ffmpeg -i input.webm -c copy output.mp4

# MKV → MP4 (스트림 복사, 재인코딩 없음)
ffmpeg -i input.mkv -c copy output.mp4

# AVI → MP4
ffmpeg -i input.avi -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4

# MOV → MP4 (Apple ProRes to H.264)
ffmpeg -i input.mov -c:v libx264 -crf 18 -preset slow -c:a aac output.mp4

# 모든 포맷 → MP4 (웹 최적화 fast start 포함)
ffmpeg -i input.* -c:v libx264 -crf 23 -preset medium -c:a aac -movflags +faststart output.mp4

CRF (고정 레이트 팩터): 품질을 제어합니다. 낮을수록 더 좋은 품질, 더 큰 파일.

  • 18: 시각적으로 무손실
  • 23: 기본값, 좋은 균형
  • 28: 더 작은 파일, 약간의 품질 손실
  • 51: 최악의 품질

3단계: 오디오 작업

# 비디오에서 오디오 추출
ffmpeg -i video.mp4 -vn -c:a copy audio.aac          # 코덱 복사 (빠름)
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3  # MP3로 변환
ffmpeg -i video.mp4 -vn -c:a flac audio.flac          # 무손실 FLAC

# 오디오 포맷 간 변환
ffmpeg -i input.wav -c:a libmp3lame -b:a 320k output.mp3
ffmpeg -i input.mp3 -c:a libopus -b:a 128k output.opus
ffmpeg -i input.flac -c:a aac -b:a 256k output.m4a

# 오디오 볼륨 정규화
ffmpeg -i input.mp3 -af loudnorm=I=-16:LRA=11:TP=-1.5 output.mp3

# 샘플 레이트 변경
ffmpeg -i input.wav -ar 44100 output.wav

# 비디오에 오디오 병합
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4

4단계: 트리밍, 자르기 및 연결

# 타임스탬프부터 지속 시간까지 트리밍
ffmpeg -i input.mp4 -ss 00:01:30 -t 00:00:45 -c copy clip.mp4    # 1:30부터 45초

# 시작부터 끝 타임스탬프까지 트리밍
ffmpeg -i input.mp4 -ss 00:05:00 -to 00:10:00 -c copy clip.mp4   # 5:00부터 10:00까지

# 처음 30초
ffmpeg -i input.mp4 -t 30 -c copy first30.mp4

# 파일 연결 (먼저 파일 목록 생성)
cat > filelist.txt << 'EOF'
file 'clip1.mp4'
file 'clip2.mp4'
file 'clip3.mp4'
EOF
ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mp4

# 재인코딩하여 연결 (코덱이 다른 경우)
ffmpeg -f concat -safe 0 -i filelist.txt -c:v libx264 -c:a aac output.mp4

5단계: 해상도 및 압축

# 1080p로 크기 조정 (종횡비 유지)
ffmpeg -i input.mp4 -vf "scale=-2:1080" -c:v libx264 -crf 23 -c:a copy output.mp4

# 720p로 크기 조정
ffmpeg -i input.mp4 -vf "scale=-2:720" -c:v libx264 -crf 23 -c:a copy output.mp4

# 특정 너비로 크기 조정 (높이 자동)
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4

# 적극적으로 압축 (더 작은 파일)
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset faster -c:a aac -b:a 96k small.mp4

# 대상 파일 크기를 위한 2패스 인코딩
ffmpeg -i input.mp4 -c:v libx264 -b:v 1M -pass 1 -an -f null /dev/null
ffmpeg -i input.mp4 -c:v libx264 -b:v 1M -pass 2 -c:a aac -b:a 128k output.mp4

# 프레임레이트 변경
ffmpeg -i input.mp4 -r 30 output.mp4

6단계: 썸네일 및 스크린샷

# 타임스탬프에서 단일 스크린샷
ffmpeg -i input.mp4 -ss 00:01:30 -frames:v 1 thumb.jpg

# 10초마다 스크린샷
ffmpeg -i input.mp4 -vf "fps=1/10" thumbs/frame_%04d.jpg

# 썸네일 그리드 (4x4 접촉 시트)
ffmpeg -i input.mp4 -vf "select='not(mod(n,300))',scale=320:-1,tile=4x4" -frames:v 1 grid.jpg

# 첫 번째 프레임 추출
ffmpeg -i input.mp4 -frames:v 1 first_frame.png

7단계: 자막

# 비디오에 자막 하드코딩
ffmpeg -i input.mp4 -vf "subtitles=subs.srt" output.mp4

# 스타일링된 ASS/SSA 자막 하드코딩
ffmpeg -i input.mp4 -vf "ass=subs.ass" output.mp4

# 자막 트랙 추가 (소프트 자막, 사용자 전환 가능)
ffmpeg -i input.mp4 -i subs.srt -c copy -c:s mov_text output.mp4

# 비디오에서 자막 추출
ffmpeg -i input.mkv -map 0:s:0 subs.srt

8단계: 필터 및 효과

# 비디오 구간에서 GIF 생성
ffmpeg -i input.mp4 -ss 5 -t 3 -vf "fps=15,scale=480:-1:flags=lanczos" output.gif

# 팔레트를 사용한 고품질 GIF
ffmpeg -i input.mp4 -ss 5 -t 3 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -ss 5 -t 3 -lavfi "fps=15,scale=480:-1:flags=lanczos[v];[v][1:v]paletteuse" output.gif

# 워터마크 추가
ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=W-w-10:H-h-10" output.mp4

# 속도 증가 / 감소
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" fast.mp4
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" slow.mp4

# 비디오 회전
ffmpeg -i input.mp4 -vf "transpose=1" rotated.mp4    # 시계 방향 90°
ffmpeg -i input.mp4 -vf "transpose=2" rotated.mp4    # 반시계 방향 90°

# 비디오 자르기 (너비:높이:x:y)
ffmpeg -i input.mp4 -vf "crop=1280:720:0:180" cropped.mp4

# 페이드 인/아웃
ffmpeg -i input.mp4 -vf "fade=in:0:30,fade=out:870:30" -af "afade=in:0:30,afade=out:870:30" output.mp4

9단계: 미디어 정보

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

# 지속 시간만
ffprobe -v quiet -show_entries format=duration -of csv=p=0 input.mp4

# 해상도
ffprobe -v quiet -select_streams v:0 -show_entries stream=width,height -of csv=p=0 input.mp4

# 코덱 정보
ffprobe -v quiet -select_streams v:0 -show_entries stream=codec_name -of csv=p=0 input.mp4

10단계: 배치 처리

# 모든 WebM 파일을 MP4로 변환
for f in *.webm; do
  ffmpeg -i "$f" -c:v libx264 -crf 23 -c:a aac "${f%.webm}.mp4"
done

# 디렉토리의 모든 MP4 파일 압축
for f in *.mp4; do
  ffmpeg -i "$f" -c:v libx264 -crf 28 -preset fast -c:a aac "compressed_${f}"
done

# 모든 비디오에서 오디오 추출
for f in *.mp4; do
  ffmpeg -i "$f" -vn -c:a libmp3lame -q:a 2 "${f%.mp4}.mp3"
done

예제

예제 1: yt-dlp 다운로드를 WebM에서 MP4로 변환

사용자 프롬프트: "yt-dlp로 비디오를 다운로드했는데 모두 .webm 파일이에요. iPhone에서 재생할 수 있도록 MP4로 변환해 주세요."

에이전트는:

  1. ffprobe를 사용하여 WebM 파일에 H.264+AAC(스트림 복사 가능) 또는 VP9+Opus(재인코딩 필요)가 포함되어 있는지 확인합니다.
  2. VP9/Opus 파일의 경우 다음을 실행합니다: for f in *.webm; do ffmpeg -i "$f" -c:v libx264 -crf 23 -preset medium -c:a aac -movflags +faststart "${f%.webm}.mp4"; done
  3. -movflags +faststart 플래그는 메타데이터를 파일 시작 부분으로 이동하여 모바일 장치와 웹 브라우저에서 즉시 재생을 가능하게 합니다.
  4. 변환 결과를 변환 전후 파일 크기와 함께 보고합니다.

예제 2: 여러 클립에서 하이라이트 릴 만들기

사용자 프롬프트: "컨퍼런스에서 찍은 5개의 비디오 클립이 있어요. 가장 좋은 부분을 트리밍하고 페이드 전환 효과와 함께 하나의 비디오로 합쳐 주세요."

에이전트는:

  1. -ss 및 -to 플래그를 사용하여 각 클립을 지정된 타임스탬프로 트리밍합니다.
  2. 모든 클립을 일치하는 코덱/해상도로 재인코딩합니다: ffmpeg -i clip.mp4 -c:v libx264 -crf 23 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1,fade=in:0:15,fade=out:st=DURATION:d=0.5" -c:a aac -ar 44100 segment_N.mp4
  3. 연결 파일 목록을 생성하고 병합합니다: ffmpeg -f concat -safe 0 -i filelist.txt -c copy highlight_reel.mp4

가이드라인

  • yt-dlp 다운로드(일반적으로 WebM/VP9+Opus)를 변환할 때는 항상 최대 장치 호환성을 위해 H.264+AAC로 재인코딩하세요. -c:v libx264 -crf 23 -c:a aac -movflags +faststart를 사용하세요.
  • 가능하면 스트림 복사(-c copy)를 사용하여 재인코딩을 피하세요. 즉시 처리되며 무손실입니다. 코덱 변경, 필터 적용 또는 소스와 대상 컨테이너가 호환되지 않는 경우에만 재인코딩하세요.
  • 웹 또는 모바일 재생용 MP4 파일을 만들 때는 항상 -movflags +faststart를 추가하세요. 이는 moov 원자를 파일 시작 부분으로 이동하여 즉시 스트리밍을 가능하게 합니다.
  • 처리 전에 ffprobe를 사용하여 입력 형식을 이해하고 불필요한 재인코딩을 피하세요.
  • 배치 작업의 경우, 전체 디렉토리에서 실행하기 전에 항상 단일 파일에서 명령을 먼저 테스트하세요.
  • 단일 패스 인코딩의 경우 비트레이트 모드보다 CRF 모드를 선호하세요. 다양한 콘텐츠 유형에서 일관된 품질을 제공합니다.

Individual skills in this repo

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

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

관련 스킬