Package: typed-ffmpeg
typed-ffmpegtyped-ffmpegoffers a modern, Pythonic interface to FFmpeg, providing extensive support for complex filters with detailed typing and documentation. Inspired byffmpeg-python, this package enhances functionality by addressing common limitations, such as lack of IDE integration and comprehensive typing, while also introducing new features like JSON serialization of filter graphs and automatic FFmpeg validation.Table of ContentsFeaturesInstallationQuick UsageDocumentationAcknowledgementsFeaturesZero Dependencies:Built purely with the Python standard library, ensuring maximum compatibility and security.User-Friendly:Simplifies the construction of filter graphs with an intuitive Pythonic interface.Comprehensive FFmpeg Filter Support:Out-of-the-box support for most FFmpeg filters, with IDE auto-completion.Integrated Documentation:In-line docstrings provide immediate reference for filter usage, reducing the need to consult external documentation.Robust Typing:Offers static and dynamic type checking, enhancing code reliability and development experience.Filter Graph Serialization:Enables saving and reloading of filter graphs in JSON format for ease of use and repeatability.Graph Visualization:Leveragesgraphvizfor visual representation, aiding in understanding and debugging.Validation and Auto-correction:Assists in identifying and fixing errors within filter graphs.Planned FeaturesPlease note that the following features are under consideration or development for future releases:Partial Evaluation:Enhance the flexibility of filter graphs by enabling partial evaluation, allowing for modular construction and reuse.Extended FFmpeg Version Support:Whiletyped-ffmpegis currently built with FFmpeg version 6.0 in mind, we are working to ensure compatibility across different FFmpeg versions. Feedback and issue reports are welcome to improve version support.Additional Filter Support:We aim to expand the range of FFmpeg filters supported bytyped-ffmpeg. Continuous updates will be made to include more complex and varied filters.Input and Output Options Support:Provide a more comprehensive interface for input and output options, including support for additional codecs and formats.InstallationTo installtyped-ffmpeg, simply use pip:pipinstalltyped-ffmpegNote: FFmpeg must be installed on your system.Visualization SupportTo enable graph visualization features:pipinstall'typed-ffmpeg[graph]'Note: This requires Graphviz to be installed on your system.Quick UsageHere's how to quickly start usingtyped-ffmpeg:importffmpeg# Flip video horizontally and outputf=(ffmpeg.input(filename='input.mp4').hflip().output(filename='output.mp4'))f.run()For a more complex example:importffmpeg# Complex filter graph examplein_file=ffmpeg.input("input.mp4")overlay_file=ffmpeg.input("overlay.png")f=(ffmpeg.concat(in_file.trim(start_frame=10,end_frame=20),in_file.trim(start_frame=30,end_frame=40),).overlay(overlay_file.hflip()).drawbox(x="50",y="50",width="120",height="120",color="red",thickness="5").output(filename="out.mp4"))f.run()See theUsagesection in our documentation for more examples and detailed guides.AcknowledgementsThis project was initially inspired by the capabilities of GPT-3, with the original concept focusing on using GPT-3 to generate an FFmpeg filter SDK directly from the FFmpeg documentation. However, during the development process, I encountered limitations with GPT-3's ability to fully automate this task.As a result, I shifted to traditional code generation methods to complete the SDK, ensuring a more robust and reliable tool. Despite this change in approach, both GitHub Copilot and GPT-3 were instrumental in accelerating the development process, providing valuable insights and saving significant time.I would also like to extend my gratitude to theffmpeg-pythonproject, which inspired this project significantly. The API style and design ideas fromffmpeg-pythonhave been influential, and I have utilized these aspects to shape the development of our SDK.This project is dedicated to my son, Austin, on his seventh birthday (February 24, 2024), whose curiosity and zest for life continually inspire me.Feel free to check theDocumentationfor detailed information and more advanced features.