{"name":"typed-ffmpeg: Type-Safe FFmpeg Bindings for Python and TypeScript","description":"typed-ffmpeg offers a modern, type-safe interface to FFmpeg for both Python and TypeScript. It provides extensive support for complex filters with detailed typing, documentation, and features like JSON serialization of filter graphs and automatic FFmpeg validation. This project enhances functionality by addressing common limitations found in similar tools, ensuring a robust development experience.","github":"https://github.com/livingbio/typed-ffmpeg","url":"https://osrepos.com/repo/livingbio-typed-ffmpeg","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/livingbio-typed-ffmpeg","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/livingbio-typed-ffmpeg.md","json":"https://osrepos.com/repo/livingbio-typed-ffmpeg.json","topics":["ffmpeg","python","typescript","media-processing","type-safe","bindings","developer-tools","npm"],"keywords":["ffmpeg","python","typescript","media-processing","type-safe","bindings","developer-tools","npm"],"stars":null,"summary":"typed-ffmpeg offers a modern, type-safe interface to FFmpeg for both Python and TypeScript. It provides extensive support for complex filters with detailed typing, documentation, and features like JSON serialization of filter graphs and automatic FFmpeg validation. This project enhances functionality by addressing common limitations found in similar tools, ensuring a robust development experience.","content":"## Introduction\n\ntyped-ffmpeg provides a modern, type-safe interface for interacting with FFmpeg in both Python and TypeScript. Inspired by `ffmpeg-python`, this project significantly enhances functionality by offering comprehensive typing, improved IDE integration, and new features such as JSON serialization of filter graphs and automatic FFmpeg validation. It supports multiple FFmpeg major versions through separate, dedicated packages, ensuring compatibility and flexibility for developers working with various FFmpeg environments. Additionally, an interactive playground is available for hands-on experimentation.\n\n## Installation\n\nTo get started with typed-ffmpeg, you can install the Python package via pip. Ensure FFmpeg is already installed on your system.\n\n**Python Installation:**\n\nInstall the latest version (bindings for FFmpeg 8.x):\n\nbash\npip install typed-ffmpeg\n\n\nOr install bindings for a specific FFmpeg version:\n\nbash\npip install typed-ffmpeg-v5   # FFmpeg 5.x\npip install typed-ffmpeg-v6   # FFmpeg 6.x\npip install typed-ffmpeg-v7   # FFmpeg 7.x\npip install typed-ffmpeg-v8   # FFmpeg 8.x\n\n\nWith optional extras:\n\nbash\npip install 'typed-ffmpeg[graph]'          # graph visualization\npip install 'typed-ffmpeg[parse]'          # CLI parsing support\npip install 'typed-ffmpeg-v7[parse]'       # CLI parsing for FFmpeg 7.x\n\n\nIf you need to install `ffmpeg-python` simultaneously, use `pip install typed-ffmpeg-compatible` to prevent module name conflicts. Then, use `import typed_ffmpeg as ffmpeg`.\n\n**TypeScript Installation (Experimental):**\n\nTypeScript bindings are available as npm packages for each FFmpeg major version.\n\nbash\nnpm install @typed-ffmpeg/core @typed-ffmpeg/v8   # latest FFmpeg bindings\n\n\nExample TypeScript usage:\n\ntypescript\nimport { input } from \"@typed-ffmpeg/v8\";\n\nconst cmd = input(\"input.mp4\")\n  .video\n  .scale({ w: 1280, h: 720 })\n  .output(\"output.mp4\")\n  .overwriteOutput()\n  .compile();\n// => [\"-i\", \"input.mp4\", \"-filter_complex\", \"...\", \"output.mp4\"]\n\n\n## Examples\n\nHere's how to quickly start using `typed-ffmpeg` in Python:\n\npython\nimport ffmpeg\n\n# Analyze a media file\ninfo = ffmpeg.probe(\"video.mp4\")\nprint(f\"Duration: {float(info['format']['duration']):.2f} seconds\")\nprint(f\"Streams: {len(info['streams'])}\")\n\n# Flip video horizontally and output\nf = (\n    ffmpeg\n    .input(filename='input.mp4')\n    .hflip()\n    .output(filename='output.mp4')\n)\nf\n\n\nFor a more complex example involving filter graphs:\n\npython\nimport ffmpeg.filters\nimport ffmpeg\n\n# Complex filter graph example\nin_file = ffmpeg.input(\"input.mp4\")\noverlay_file = ffmpeg.input(\"overlay.png\")\n\nf = (\n    ffmpeg.filters\n    .concat(\n        in_file.trim(start_frame=10, end_frame=20),\n        in_file.trim(start_frame=30, end_frame=40),\n    )\n    .video(0)\n    .overlay(overlay_file.hflip())\n    .drawbox(x=\"50\", y=\"50\", width=\"120\", height=\"120\", color=\"red\", thickness=\"5\")\n    .output(filename=\"out.mp4\")\n)\nf\n\n\nFor more examples and detailed guides, refer to the [official documentation](https://livingbio.github.io/typed-ffmpeg/).\n\n## Why Use typed-ffmpeg?\n\ntyped-ffmpeg offers a robust set of features that make it an excellent choice for media processing tasks:\n\n*   **Zero Dependencies:** Built purely with the Python standard library, ensuring maximum compatibility and security.\n*   **User-Friendly:** Simplifies the construction of filter graphs with an intuitive Pythonic interface.\n*   **Comprehensive FFmpeg Filter Support:** Out-of-the-box support for most FFmpeg filters, complete with IDE auto-completion and in-line docstrings for immediate reference.\n*   **Robust Typing:** Provides static and dynamic type checking, significantly enhancing code reliability and development experience.\n*   **Filter Graph Serialization:** Enables saving and reloading of filter graphs in JSON format for ease of use and repeatability.\n*   **Graph Visualization:** Leverages `graphviz` for visual representation, aiding in understanding and debugging complex filter chains.\n*   **Validation and Auto-correction:** Assists in identifying and fixing errors within filter graphs, streamlining development.\n*   **Input and Output Options Support:** Offers a comprehensive interface for input and output options, including support for additional codecs and formats.\n*   **Partial Evaluation:** Enhances the flexibility of filter graphs by enabling modular construction and reuse.\n*   **Media File Analysis:** Built-in support for analyzing media files using FFmpeg's `ffprobe` utility, providing detailed metadata extraction.\n\n## Links\n\n*   **GitHub Repository:** [https://github.com/livingbio/typed-ffmpeg](https://github.com/livingbio/typed-ffmpeg)\n*   **Official Documentation:** [https://livingbio.github.io/typed-ffmpeg/](https://livingbio.github.io/typed-ffmpeg/)\n*   **PyPI Package:** [https://pypi.org/project/typed-ffmpeg/](https://pypi.org/project/typed-ffmpeg/)\n*   **npm Packages:** `@typed-ffmpeg/core`, `@typed-ffmpeg/v5` through `@typed-ffmpeg/v8`\n*   **Interactive Playground:** [https://livingbio.github.io/typed-ffmpeg-playground/](https://livingbio.github.io/typed-ffmpeg-playground/)","metrics":{"detailViews":5,"githubClicks":6},"dates":{"published":null,"modified":"2026-04-11T19:28:24.000Z"}}