Communitygithub.com

FFmpeg

Transkodieren, konvertieren, bearbeiten und verarbeiten von Audio und Video mit FFmpeg. Verwenden, wenn ein Benutzer nach Konvertierung von Videoformaten (WebM zu MP4, MKV zu MP4), Audioextraktion aus Video, Videokomprimierung, Trimmen oder Schneiden von Clips, Zusammenfügen von Videos, Hinzufügen von Untertiteln, Erstellen von Thumbnails, Anwenden von Filtern, Ändern der Auflösung oder Bitrate, Neucodierung von Medien, Erstellung von GIFs aus Videos, Hinzufügen von Wasserzeichen, Audionormalisierung, Medienstreaming oder Aufbau automatisierter Medienverarbeitungspipelines fragt.

Was ist FFmpeg?

FFmpeg ist das Schweizer Taschenmesser der Medienverarbeitung. Es unterstützt praktisch jedes Audio- und Videoformat, jeden Codec und Container. Diese Skill-Anleitung deckt Formatkonvertierung, Codec-Transkodierung, Trimmen, Zusammenfügen, Filtern, Komprimierung, Thumbnail-Extraktion, Untertiteleinbettung, Audionormalisierung, GIF-Erstellung, Wasserzeichen und Pipeline-Integration mit Tools wie yt-dlp und gallery-dl ab. Der Skill bietet klare, schrittweise Anleitungen für Installations- und häufige Aufgaben und enthält praktische Beispiele, wie etwa die Konvertierung von yt-dlp-Downloads von WebM zu MP4 oder die Erstellung von Highlight-Reels aus mehreren Clips. Es werden Best Practices betont, wie die Verwendung von Stream-Kopien (`-c copy`) wann immer möglich zur Vermeidung von Qualitätsverlusten, das Hinzufügen von `-movflags +faststart` für web-optimierte MP4-Dateien und die Bevorzugung des CRF-Modus gegenüber der Bitratensteuerung für konsistente Qualität.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/ffmpeg

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht FFmpeg?

Übersicht

FFmpeg ist das Schweizer Taschenmesser der Medienverarbeitung. Es unterstützt praktisch jedes Audio- und Videoformat, jeden Codec und Container. Diese Skill-Anleitung behandelt Formatkonvertierung, Codec-Transkodierung, Trimmen, Zusammenfügen, Filtern, Komprimierung, Thumbnail-Extraktion, Untertiteleinbettung, Audionormalisierung, GIF-Erstellung, Wasserzeichen und Pipeline-Integration mit Tools wie yt-dlp und gallery-dl.

Anleitung

Schritt 1: Installation

# Ubuntu/Debian
sudo apt install -y ffmpeg

# macOS
brew install ffmpeg

# Überprüfung
ffmpeg -version
ffprobe -version   # Medieninformations-Tool, in ffmpeg enthalten

Schritt 2: Formatkonvertierung

Die häufigste Aufgabe – die Konvertierung zwischen Containerformaten und Codecs.

# WebM → MP4 (Neuencodierung zu H.264 + AAC für universelle Kompatibilität)
ffmpeg -i input.webm -c:v libx264 -c:a aac -movflags +faststart output.mp4

# WebM → MP4 (Streams kopieren, falls bereits H.264/AAC — sofortig, kein Qualitätsverlust)
ffmpeg -i input.webm -c copy output.mp4

# MKV → MP4 (Stream-Kopie, keine Neuencodierung)
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 zu H.264)
ffmpeg -i input.mov -c:v libx264 -crf 18 -preset slow -c:a aac output.mp4

# Beliebiges Format → MP4 mit web-optimiertem Fast Start
ffmpeg -i input.* -c:v libx264 -crf 23 -preset medium -c:a aac -movflags +faststart output.mp4

CRF (Constant Rate Factor): Steuert die Qualität. Niedriger = bessere Qualität, größere Datei.

  • 18: Visuell verlustfrei
  • 23: Standard, gute Balance
  • 28: Kleinere Datei, etwas Qualitätsverlust
  • 51: Schlechteste Qualität

Schritt 3: Audio-Operationen

# Audio aus Video extrahieren
ffmpeg -i video.mp4 -vn -c:a copy audio.aac          # Codec kopieren (schnell)
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3  # In MP3 konvertieren
ffmpeg -i video.mp4 -vn -c:a flac audio.flac          # Verlustfreies FLAC

# Zwischen Audioformaten konvertieren
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

# Audiolautstärke normalisieren
ffmpeg -i input.mp3 -af loudnorm=I=-16:LRA=11:TP=-1.5 output.mp3

# Sample-Rate ändern
ffmpeg -i input.wav -ar 44100 output.wav

# Audio in Video einfügen
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4

Schritt 4: Trimmen, Schneiden und Zusammenfügen

# Von Zeitstempel bis Dauer trimmen
ffmpeg -i input.mp4 -ss 00:01:30 -t 00:00:45 -c copy clip.mp4    # 45s ab 1:30

# Von Start- bis Endzeitstempel trimmen
ffmpeg -i input.mp4 -ss 00:05:00 -to 00:10:00 -c copy clip.mp4   # 5:00 bis 10:00

# Erste 30 Sekunden
ffmpeg -i input.mp4 -t 30 -c copy first30.mp4

# Dateien zusammenfügen (zuerst Dateiliste erstellen)
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

# Zusammenfügen mit Neuencodierung (wenn Codecs unterschiedlich)
ffmpeg -f concat -safe 0 -i filelist.txt -c:v libx264 -c:a aac output.mp4

Schritt 5: Auflösung und Komprimierung

# Auf 1080p skalieren (Seitenverhältnis beibehalten)
ffmpeg -i input.mp4 -vf "scale=-2:1080" -c:v libx264 -crf 23 -c:a copy output.mp4

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

# Auf bestimmte Breite skalieren (Höhe automatisch)
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4

# Aggressiv komprimieren (kleinere Datei)
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset faster -c:a aac -b:a 96k small.mp4

# Zweipass-Encodierung für Zieldateigröße
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

# Bildrate ändern
ffmpeg -i input.mp4 -r 30 output.mp4

Schritt 6: Thumbnails und Screenshots

# Einzelner Screenshot zu einem Zeitstempel
ffmpeg -i input.mp4 -ss 00:01:30 -frames:v 1 thumb.jpg

# Screenshot alle 10 Sekunden
ffmpeg -i input.mp4 -vf "fps=1/10" thumbs/frame_%04d.jpg

# Thumbnail-Raster (4x4 Kontaktabzug)
ffmpeg -i input.mp4 -vf "select='not(mod(n,300))',scale=320:-1,tile=4x4" -frames:v 1 grid.jpg

# Erstes Bild extrahieren
ffmpeg -i input.mp4 -frames:v 1 first_frame.png

Schritt 7: Untertitel

# Untertitel in Video einbrennen (fest codiert)
ffmpeg -i input.mp4 -vf "subtitles=subs.srt" output.mp4

# ASS/SSA-Untertitel mit Styling einbrennen
ffmpeg -i input.mp4 -vf "ass=subs.ass" output.mp4

# Untertitelspur hinzufügen (weiche Untertitel, Benutzer kann ein-/ausschalten)
ffmpeg -i input.mp4 -i subs.srt -c copy -c:s mov_text output.mp4

# Untertitel aus Video extrahieren
ffmpeg -i input.mkv -map 0:s:0 subs.srt

Schritt 8: Filter und Effekte

# GIF aus Videoausschnitt erstellen
ffmpeg -i input.mp4 -ss 5 -t 3 -vf "fps=15,scale=480:-1:flags=lanczos" output.gif

# Hochwertiges GIF mit Palette
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

# Wasserzeichen hinzufügen
ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=W-w-10:H-h-10" output.mp4

# Beschleunigen / Verlangsamen
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

# Video drehen
ffmpeg -i input.mp4 -vf "transpose=1" rotated.mp4    # 90° im Uhrzeigersinn
ffmpeg -i input.mp4 -vf "transpose=2" rotated.mp4    # 90° gegen Uhrzeigersinn

# Video zuschneiden (Breite:Höhe:x:y)
ffmpeg -i input.mp4 -vf "crop=1280:720:0:180" cropped.mp4

# Ein-/Ausblenden
ffmpeg -i input.mp4 -vf "fade=in:0:30,fade=out:870:30" -af "afade=in:0:30,afade=out:870:30" output.mp4

Schritt 9: Medieninformationen

# Vollständige Medieninfo
ffprobe -v quiet -print_format json -show_format -show_streams input.mp4

# Nur Dauer
ffprobe -v quiet -show_entries format=duration -of csv=p=0 input.mp4

# Auflösung
ffprobe -v quiet -select_streams v:0 -show_entries stream=width,height -of csv=p=0 input.mp4

# Codec-Info
ffprobe -v quiet -select_streams v:0 -show_entries stream=codec_name -of csv=p=0 input.mp4

Schritt 10: Stapelverarbeitung

# Alle WebM-Dateien in MP4 konvertieren
for f in *.webm; do
  ffmpeg -i "$f" -c:v libx264 -crf 23 -c:a aac "${f%.webm}.mp4"
done

# Alle MP4-Dateien im Verzeichnis komprimieren
for f in *.mp4; do
  ffmpeg -i "$f" -c:v libx264 -crf 28 -preset fast -c:a aac "compressed_${f}"
done

# Audio aus allen Videos extrahieren
for f in *.mp4; do
  ffmpeg -i "$f" -vn -c:a libmp3lame -q:a 2 "${f%.mp4}.mp3"
done

Beispiele

Beispiel 1: yt-dlp-Downloads von WebM zu MP4 konvertieren

Benutzeraufforderung: "Ich habe Videos mit yt-dlp heruntergeladen, aber sie sind alle .webm-Dateien. Konvertiere sie in MP4, damit sie auf meinem iPhone abspielbar sind."

Der Agent wird:

  1. Mit ffprobe prüfen, ob die WebM-Dateien H.264+AAC enthalten (Stream-Kopie möglich) oder VP9+Opus (Neuencodierung erforderlich).
  2. Für VP9/Opus-Dateien ausführen: 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. Das -movflags +faststart-Flag verschiebt die Metadaten an den Dateianfang, was sofortige Wiedergabe auf mobilen Geräten und Webbrowsern ermöglicht.
  4. Die Konvertierungsergebnisse mit Dateigrößen vorher und nachher melden.

Beispiel 2: Einen Highlight-Reel aus mehreren Clips erstellen

Benutzeraufforderung: "Ich habe 5 Videoclips von einer Konferenz. Schneide die besten Teile aus und füge sie mit Überblendungen zu einem Video zusammen."

Der Agent wird:

  1. Jeden Clip auf die angegebenen Zeitstempel mit den Flags -ss und -to zuschneiden.
  2. Alle Clips mit übereinstimmendem Codec/Auflösung neu encodieren: 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. Eine concat-Dateiliste erstellen und zusammenfügen: ffmpeg -f concat -safe 0 -i filelist.txt -c copy highlight_reel.mp4

Richtlinien

  • Beim Konvertieren von yt-dlp-Downloads (typischerweise WebM/VP9+Opus) immer zu H.264+AAC neu encodieren, um maximale Gerätekompatibilität zu gewährleisten. Verwenden Sie -c:v libx264 -crf 23 -c:a aac -movflags +faststart.
  • Verwenden Sie Stream-Kopie (-c copy) wann immer möglich, um Neuencodierung zu vermeiden — sie ist sofortig und verlustfrei. Nur neu encodieren, wenn Codecs geändert, Filter angewendet werden oder wenn Quell- und Zielcontainer inkompatibel sind.
  • Fügen Sie -movflags +faststart immer hinzu, wenn MP4-Dateien für Web- oder Mobilwiedergabe erstellt werden; es verschiebt das moov-Atom an den Dateianfang für sofortiges Streaming.
  • Verwenden Sie vor der Verarbeitung ffprobe, um das Eingabeformat zu verstehen und unnötige Neuencodierung zu vermeiden.
  • Testen Sie bei Stapeloperationen den Befehl zuerst an einer einzelnen Datei, bevor Sie ihn auf das gesamte Verzeichnis anwenden.
  • Bevorzugen Sie den CRF-Modus gegenüber dem Bitratenmodus für Ein-Pass-Encodierung; er liefert konsistente Qualität über verschiedene Inhaltstypen hinweg.

Individual skills in this repo

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

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

TerminalSkills/skills

>- Lovable (formerly GPT Engineer) is a browser-based AI app builder that turns a natural-language description into a working full-stack web app with a built-in backend, authentication, database and one-click publishing. Use when the user wants to prototype or ship a web app with Lovable, write effective Lovable prompts, connect Supabase or GitHub, review generated security rules, or move a Lovable project into their own editor.

Verwandte Skills