ffmpeg/SKILL.md
Expert guide for FFmpeg video/audio processing, conversion, streaming, and filtering. Use when working with video, audio, multimedia files, transcoding, format conversion, or when the user mentions ffmpeg, media processing, video conversion, audio conversion, streaming, or codecs.
npx skillsauth add atxinsky/skills ffmpegInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guide for FFmpeg command-line tool for video/audio processing, transcoding, streaming, and filtering.
Basic format conversion:
ffmpeg -i input.mp4 output.avi
Convert video with specific codec:
ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mp4
Extract audio from video:
ffmpeg -i input.mp4 -vn -acodec copy output.aac
First, clarify what the user wants to do:
Use ffprobe to inspect media files:
ffprobe -v error -show_format -show_streams input.mp4
Key information to gather:
FFmpeg follows this syntax:
ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...
-ss position: Seek to position-t duration: Limit input duration-r fps: Set frame rate (input)-c[:stream_specifier] codec: Set codec (use copy for streamcopy)-b[:stream_specifier] bitrate: Set bitrate-s size: Set frame size (WxH)-r fps: Set frame rate (output)-vf filtergraph: Video filter-af filtergraph: Audio filter-map input_file_id[:stream_specifier]: Map streams-an / -vn / -sn: Disable audio/video/subtitleFast, no quality loss:
ffmpeg -i input.mp4 -c copy output.mkv
# CRF-based quality (recommended)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a aac output.mp4
# Bitrate-based
ffmpeg -i input.mp4 -c:v libx264 -b:v 2M -maxrate 2M -bufsize 4M -c:a aac output.mp4
# Scale to specific size
ffmpeg -i input.mp4 -vf scale=1280:720 output.mp4
# Scale maintaining aspect ratio
ffmpeg -i input.mp4 -vf scale=-1:720 output.mp4 # Height 720, auto width
ffmpeg -i input.mp4 -vf scale=1280:-1 output.mp4 # Width 1280, auto height
# Extract audio
ffmpeg -i input.mp4 -vn -acodec copy audio.aac
# Extract video
ffmpeg -i input.mp4 -an -vcodec copy video.h264
# Extract subtitle
ffmpeg -i input.mkv -map 0:s:0 subs.srt
# Using -ss (inputseek - fast)
ffmpeg -ss 00:01:00 -i input.mp4 -to 00:02:00 -c copy output.mp4
# Using -ss (outputseek - accurate but slow)
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4
# Concatenate with filter
ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mp4
# filelist.txt contains:
# file '/path/to/video1.mp4'
# file '/path/to/video2.mp4'
# High quality GIF
ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif
# Simple GIF
ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1" output.gif
# macOS
ffmpeg -f avfoundation -i "1:0" -r 30 output.mp4
# Linux (X11)
ffmpeg -f x11grab -s 1920x1080 -r 30 -i :0.0 output.mp4
# Windows
ffmpeg -f gdigrab -framerate 30 -i desktop output.mp4
Apply options to specific streams:
:v - All video streams:a - All audio streams:s - All subtitle streams:v:0 - First video stream:a:1 - Second audio stream:0:v:0 - Video stream 0 from input 0Examples:
# Different codecs for different streams
ffmpeg -i input.mkv -c:v:0 libx264 -c:v:1 libx265 output.mkv
# Copy audio, re-encode video
ffmpeg -i input.mp4 -c:v libx264 -c:a copy output.mp4
# Deinterlace
ffmpeg -i input.mp4 -vf yadif output.mp4
# Crop
ffmpeg -i input.mp4 -vf crop=1280:720:0:0 output.mp4 # W:H:X:Y
# Rotate
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
# Overlay text
ffmpeg -i input.mp4 -vf "drawtext=text='Hello':fontsize=24:fontcolor=white:x=10:y=10" output.mp4
# Overlay image on video
ffmpeg -i video.mp4 -i overlay.png -filter_complex overlay output.mp4
# Stack videos horizontally
ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4
# Volume adjustment
ffmpeg -i input.mp4 -af "volume=1.5" output.mp4
# Normalize audio
ffmpeg -i input.mp4 -af "loudnorm" output.mp4
# Fade in/out
ffmpeg -i input.mp4 -af "afade=t=in:st=0:d=2,afade=t=out:st=50:d=2" output.mp4
# Pass 1
ffmpeg -i input.mp4 -c:v libx264 -pass 1 -an -f null /dev/null
# Pass 2
ffmpeg -i input.mp4 -c:v libx264 -pass 2 -b:v 2M output.mp4
# NVIDIA (NVENC)
ffmpeg -hwaccel cuda -i input.mp4 -c:v h264_nvenc output.mp4
# Intel (QSV)
ffmpeg -hwaccel qsv -i input.mp4 -c:v h264_qsv output.mp4
# macOS (VideoToolbox)
ffmpeg -hwaccel videotoolbox -i input.mp4 -c:v h264_videotoolbox output.mp4
ffmpeg -i input.mp4 -c:v libx264 -c:a aac -f hls -hls_time 4 -hls_playlist_type vod output.m3u8
# Extract one frame per second
ffmpeg -i input.mp4 -vf "fps=1" frame_%04d.png
# Extract frame at specific time
ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 frame.png
CRF (Constant Rate Factor): Recommended for quality-based encoding
Presets: Balance encoding speed vs compression
ultrafast, superfast, veryfast, faster, fastmedium (default)slow, slower, veryslow-c copy) when not transcoding - much fasterveryfast for live, veryslow for final encode-threads option (usually auto is best)-vsync options if audio drift occurslibx264 - H.264 (most compatible)libx265 / hevc - H.265 (better compression)libvpx-vp9 - VP9 (WebM)libaom-av1 - AV1 (next-gen)mpeg4 - MPEG-4 Part 2 (legacy)copy - Streamcopy (no re-encoding)aac - AAC (standard)libmp3lame - MP3libopus - Opus (modern)libvorbis - Vorbis (WebM)pcm_s16le - Uncompressed PCMcopy - Streamcopymp4 - Most compatiblemkv - Feature-richwebm - Web optimized (VP8/VP9)avi - Legacymov - QuickTimeflv - Flash video# Map all streams from input
ffmpeg -i input.mp4 -map 0 output.mkv
# Map only video from first input
ffmpeg -i input.mp4 -map 0:v output.mp4
# Map specific streams
ffmpeg -i1.mkv -i2.mp4 -map 0:0 -map 1:1 output.mp4
# Negative mapping (exclude)
ffmpeg -i input.mp4 -map 0 -map -0:a output.mp4 # Exclude all audio
# Map by language
ffmpeg -i input.mkv -map 0:m:language:eng output.mp4
ffmpeg -codecs-vsync modes-async 1 to sync audio to video-threadsFor complex filtergraphs, see filter documentation
For codec options, use:
ffmpeg -h encoder=libx264
ffmpeg -h decoder=h264
For format options:
ffmpeg -h muxer=mp4
ffmpeg -h demuxer=mp4
development
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment
development
Use when you have a spec or requirements for a multi-step task, before touching code
documentation
Create detailed implementation plan with bite-sized tasks