josiahsiegel/claude-plugin-marketplace

ffmpeg-opencv-integration

Complete FFmpeg + OpenCV + Python integration guide for video processing pipelines.

查看源码

使用方法

  1. 复制安装命令,在自己的智能体环境安装前先检查源码包。
  2. 从原始文档核对所需工具、凭据和支持的宿主。
  3. 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill ffmpeg-opencv-integration

开始前需了解

  • 安装不包含模型订阅、API 额度或访问文件的权限。
  • 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

FFmpeg + OpenCV Integration Guide

Use this skill when FFmpeg handles video I/O and OpenCV handles image processing. This SKILL is a lean orchestrator; full pipe patterns, library examples, and Modal recipes are preserved in references/opencv-pipelines-and-libraries.md.

When to Use

  • Decode with FFmpeg and process frames with OpenCV
  • Encode OpenCV-generated/processed frames with FFmpeg
  • Compare cv2.VideoCapture, subprocess pipes, PyAV, ffmpegcv, VidGear, and Decord
  • Fix RGB/BGR color bugs or (height, width) dimension-order bugs
  • Preserve audio while replacing processed video frames
  • Build GPU-assisted video I/O around CPU OpenCV processing

Library Selection

NeedBest optionWhy
Simple local filecv2.VideoCaptureBuilt-in and simple
Full FFmpeg format/protocol supportsubprocess pipeExact CLI behavior
GPU video I/OffmpegcvNVDEC/NVENC with OpenCV-like API
Network/RTSP streamingVidGearThreaded capture and stream helpers
ML batch loadingDecordFast random/batch frame access
Frame-level libav controlPyAVDirect FFmpeg library access

Critical Gotchas

  1. OpenCV is BGR. FFmpeg/PyAV/PIL/Decord often produce RGB. Convert explicitly.
  2. NumPy dimensions are `(height, width, channels)`. Pixel access is img[y, x], not img[x, y].
  3. Video filters can drop audio. Preserve or remux original audio intentionally.
  4. Release resources. Always close VideoCapture, pipes, writers, and PyAV containers.
  5. Rawvideo pipes require exact frame size. width * height * channels must match -pix_fmt.

Minimal Pipe Patterns

FFmpeg to OpenCV using BGR frames:

python
cmd = [
    "ffmpeg", "-i", input_path,
    "-f", "rawvideo", "-pix_fmt", "bgr24", "-"
]

OpenCV to FFmpeg using BGR frames:

python
cmd = [
    "ffmpeg", "-y",
    "-f", "rawvideo", "-vcodec", "rawvideo",
    "-s", f"{width}x{height}", "-pix_fmt", "bgr24",
    "-r", str(fps), "-i", "-",
    "-c:v", "libx264", "-preset", "fast", "-crf", "23",
    "-pix_fmt", "yuv420p", output_path
]

Core Workflow

  1. Probe input dimensions, fps, duration, and audio streams.
  2. Pick the I/O library based on the selection table.
  3. Lock pixel format at boundaries (bgr24 for OpenCV pipes; yuv420p for final H.264 output).
  4. Process frames in generators/batches; avoid loading full videos unless they are small.
  5. Preserve or re-encode audio explicitly.
  6. Verify output duration, fps, resolution, codec, and A/V sync.

Reference Map

  • references/opencv-pipelines-and-libraries.md - Full preserved reference: color/dimension gotchas, cleanup patterns, FFmpeg-to-OpenCV and OpenCV-to-FFmpeg pipes, bidirectional pipeline, ffmpegcv, VidGear, Decord, PyAV, Modal.com examples, GPU pipeline, cheat sheets, sources.

Related Skills

  • ffmpeg-python-integration-reference - Type-safe parameters, colors, time units
  • ffmpeg-pyav-integration - PyAV API details
  • ffmpeg-hardware-acceleration - GPU decode/encode and filter pipelines

按任务相关推荐

来自同一仓库

更多 Skills

全部 Skills
josiahsiegel
社区

tui-fundamentals

This skill should be used when the user asks to design, create, choose, modernize, or review a terminal UI, text user interface, curses app, dashboard, wizard, REPL shell, prompt flow, or CLI with interactive screens. PROACTIVELY activate for: TUI architecture, terminal-ui design, framework selection, curses vs modern framework, full-screen vs inline UI, app state modeling, widget composition, command palette, keyboard-first workflow, terminal dashboard, interactive CLI UX, and cross-platform te

安装量
2
GitHub Stars
59
最近更新
6月18日
josiahsiegel
社区

unity-modding

Unity game modding architecture and mod-loading systems. PROACTIVELY activate for: (1) adding modding support to a Unity game, (2) Asset Bundles for mods, (3) Addressables for mod content, (4) Lua scripting via MoonSharp, (5) Harmony patching for runtime IL injection, (6) Steam Workshop integration, (7) mod manager UI, (8) plugin architecture for user-generated content (UGC), (9) custom content loading at runtime, (10) sandboxing and security for untrusted mods. Provides: AssetBundle vs Addressa

安装量
2
GitHub Stars
59
最近更新
6月18日
josiahsiegel
社区

git-master

Complete Git expertise system for ALL git operations. PROACTIVELY activate for: (1) ANY Git task (basic/advanced/dangerous), (2) Repository management, (3) Branch strategies and workflows, (4) Conflict resolution, (5) History rewriting/recovery, (6) Platform-specific operations (GitHub/Azure DevOps/Bitbucket), (7) Advanced commands (rebase/cherry-pick/filter-repo). Provides: complete Git command reference, safety guardrails for destructive operations, platform best practices, workflow strategies

安装量
2
GitHub Stars
58
最近更新
6月18日
josiahsiegel
社区

ssdt-cicd-best-practices-2025

Modern SSDT CI/CD best practices for SQL Server database development (2025). PROACTIVELY activate for: (1) SSDT CI/CD pipeline design, (2) state-based deployment with DACPACs, (3) tSQLt unit testing integration, (4) database build validation in CI, (5) drift detection via SqlPackage Extract + Compare, (6) Azure DevOps and GitHub Actions templates for SSDT, (7) publish profile management per environment, (8) pre/post deploy scripts with idempotent MERGE, (9) DACPAC versioning and artifacts, (10)

安装量
1
GitHub Stars
58
最近更新
6月18日