Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ffmpeg

БесплатноБез исполняемых скриптовНе проверен

Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

FFmpeg

Overview

FFmpeg is the Swiss Army knife of media processing. It handles virtually every audio and video format, codec, and container in existence. This skill covers format conversion, codec transcoding, trimming, concatenation, filtering, compression, thumbnail extraction, subtitle embedding, audio normalization, GIF creation, watermarking, and and batch loops. Every command below was run against FFmpeg 6.1.

Instructions

Step 1: Installation

# Ubuntu/Debian
sudo apt install -y ffmpeg

# macOS
brew install ffmpeg

# Verify
ffmpeg -version
ffprobe -version   # media info tool, bundled with ffmpeg

Step 2: Format Conversion

The most common task — converting between container formats and codecs.

# WebM → MP4 (re-encode to H.264 + AAC for universal compatibility)
ffmpeg -i input.webm -c:v libx264 -c:a aac -movflags +faststart output.mp4

# WebM → MP4 (copy streams if already H.264/AAC — instant, no quality loss)
ffmpeg -i input.webm -c copy output.mp4

# MKV → MP4 (stream copy, no re-encoding)
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

# Web/phone-safe MP4: faststart plus 4:2:0 pixels
ffmpeg -i input.mov -c:v libx264 -crf 23 -preset medium -pix_fmt yuv420p -c:a aac -movflags +faststart output.mp4

# H.265 (about half the size; -tag:v hvc1 makes it play in QuickTime and on iPhones)
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -tag:v hvc1 -c:a aac output-hevc.mp4

Add -pix_fmt yuv420p whenever the file must play on phones, Safari or TVs: libx264 keeps the source pixel format, and a 4:4:4 or 10-bit source gives an H.264 file many players refuse. Stream copy (-c copy) from WebM only works for the container; WebM almost always holds VP9/Opus, which iPhones and many TVs cannot play, so re-encode for those targets.

CRF (Constant Rate Factor): Controls quality. Lower = better quality, larger file.

  • 18: Visually lossless
  • 23: Default, good balance
  • 28: Smaller file, some quality loss
  • 51: Worst quality

Step 3: Audio Operations

# Extract audio from video
ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 video.mp4  # aac?
ffmpeg -i video.mp4 -vn -c:a copy audio.aac          # Copy codec (fast, only if the source audio is AAC)
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3  # Convert to MP3
ffmpeg -i video.mp4 -vn -c:a flac audio.flac          # Lossless FLAC

# Convert between audio formats
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

# Normalize loudness (single pass is dynamic; for accurate two-pass, first run with
# print_format=json -f null - and feed the measured_* values back as measured_I=… etc.)
ffmpeg -i input.mp3 -af loudnorm=I=-16:LRA=11:TP=-1.5 output.mp3
ffmpeg -i input.mp3 -af loudnorm=I=-16:LRA=11:TP=-1.5:print_format=json -f null -

# Change sample rate
ffmpeg -i input.wav -ar 44100 output.wav

# Merge audio into video
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4

Step 4: Trim, Cut, and Concatenate

# Fast cut (stream copy): the start snaps to a keyframe, so it can be off by seconds
ffmpeg -ss 00:01:30 -i input.mp4 -t 00:00:45 -c copy clip.mp4    # 45s starting near 1:30

# Frame-accurate cut: re-encode
ffmpeg -ss 00:05:00 -to 00:10:00 -i input.mp4 -c:v libx264 -crf 23 -c:a aac clip.mp4   # 5:00 to 10:00

# First 30 seconds
ffmpeg -i input.mp4 -t 30 -c copy first30.mp4

With -ss before -i the seek is fast. In FFmpeg 6.1 -to then still means a position in the source, so -ss 00:05:00 -to 00:10:00 writes 5 minutes; use -t for a duration. Put -ss after -i only if you need to decode up to that point.

# Concatenate files (create file list first)
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

# Concatenate with re-encoding (when codecs differ)
ffmpeg -f concat -safe 0 -i filelist.txt -c:v libx264 -c:a aac output.mp4

Step 5: Resolution and Compression

# Resize to 1080p (maintain aspect ratio)
ffmpeg -i input.mp4 -vf "scale=-2:1080" -c:v libx264 -crf 23 -c:a copy output.mp4

# Resize to 720p
ffmpeg -i input.mp4 -vf "scale=-2:720" -c:v libx264 -crf 23 -c:a copy output.mp4

# Resize to specific width (height auto)
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4

# Compress aggressively (smaller file)
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset faster -c:a aac -b:a 96k small.mp4

# Two-pass encoding for target file size
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
rm -f ffmpeg2pass-0.log ffmpe
Полный SKILL.md на GitHub

Установить ffmpeg в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл ffmpeg?

Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

Как установить скилл ffmpeg?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ffmpeg запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ffmpeg с