High-performance Real-time FFmpeg based Video-Decoder in python.
Project description
Overview
DeFFcode is a powerful High-performance Real-time Video frames Generator that wraps FFmpeg pipeline inside a subprocess module for generating blazingly fast video frames in python 🔥
The primary purpose of DeFFcode is to provide a cross-platform solution for fast and low-overhead decoding of a wide range of video streams into 3D ndarray
frames while providing complete control over the underlying FFmpeg pipeline without the need to go deeper into hefty documentation and in just a few lines of python code.
DeFFcode can extract frames in real-time with any custom specification imaginable such as Framerate, Resolution, Hardware decoding, Complex Filters into any pixel format while giving users the complete freedom to play with any desired FFmpeg supported parameter. On top of that, DeFFcode enables effortless and precise FFmpeg Frame Seeking natively.
Finally, DeFFcode APIs are designed with simplicity, flexibility, and modularity in mind for the best developer experience.
Key Features
DeFFcode APIs are build on FFmpeg - a leading multimedia framework, that gives you the following:
- Extremely exceptional real-time performance ⚡ with low-memory footprints.
- Flexible API with access to almost every parameter available within FFmpeg.
- Fast dedicated Hardware-Accelerated Decoding.
- Precise FFmpeg Frame Seeking with pinpoint accuracy.
- Extensive support for real-time Complex FFmpeg Filters.
- Out-of-the-box support for Computer Vision libraries like OpenCV, Pytorch, etc.
- Support a wide range of media files, devices, image-sequence and network streams.
- Easier to ingest streams into any pixel format that FFmpeg supports.
- Lossless Transcoding support with WriteGear.
- Fewer hard dependencies, and easy to install.
- Designed modular for best developer experience.
- Cross-platform and runs on Python 3.7+
Requirements
- Python 3.7+
- FFmpeg (See this doc for its installation)
Installation
Installation is as simple as:
$ (sudo) pip install deffcode
💡 For more details, see installation notes.
Getting Started
📚 Documentation: https://abhitronix.github.io/deffcode
The default function of DeFFcode's FFdecoder API is to generate 24-bit RGB (3D ndarray
) frames from the given source:
# import the necessary packages
from deffcode import FFdecoder
# formulate the decoder with suitable source(for e.g. foo.mp4)
decoder = FFdecoder("foo.mp4").formulate()
# grab RGB24(default) 3D frames from decoder
for frame in decoder.generateFrame():
# lets print its shape
print(frame.shape)
# print metadata as `json.dump`
print(decoder.metadata)
# terminate the decoder
decoder.terminate()
For more examples and in-depth usage guide, kindly refer our Basic Recipes 🥧 and Advanced Recipes 🔬
💡 In case you're run into any problems, consult our Help section.
Roadmap
- Add clean and elegant documentation.
- Add project Issue and PR templates.
- Add related unit tests with
pytests
. - Automate stuff with Continuous Integration.
- Add Devices and Screen Capture support.
- Add Multiple Source Inputs support.
- Resolve High CPU usage issue with WriteGear API.
- Add more parameters to Sourcer API's metadata.
- Implement Buffer and Audio pass-through modes.
- Add recipe for Source with Multiple Embedded Streams.
- Add example to dynamically change writable FFdecoder API's metadata parameters.
- Add more Advanced Recipes and use cases.
- Add preliminary benchmarks.
- Make Frame Seeking dynamic.
Contributions
Contributions are welcome. We'd love to have your contributions to fix bugs or to implement new features!
Please see our Contribution Guidelines for more details.
Community Support
Join our Gitter community channel for quick discussions:
Donations
DeFFcode is free and open source and will always remain so. ❤️
It is something I am doing with my own free time. If you would like to say thanks, please feel free to make a donation:
Copyright
Copyright (c) abhiTronix 2021
This library is released under the Apache 2.0 License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.