Skip to main content

High-performance Real-time Video frames Generator for generating blazingly fast video frames in python.

Project description

DeFFcode

Build Status Codecov branch Azure DevOps builds (branch)

Glitter chat Build Status PyPi version

Code Style

DeFFcode tagline

Releases   |   Documentation   |   Installation   |   License


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 Multiple Source Inputs support.
  • Add Devices and Screen Capture 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:

Gitter

 

Donations

PiGear

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:

ko-fi

 

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.

Source Distribution

deffcode-0.2.0.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

deffcode-0.2.0-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file deffcode-0.2.0.tar.gz.

File metadata

  • Download URL: deffcode-0.2.0.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/26.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.0.1 keyring/21.4.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for deffcode-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b80ce3161cad7d83737fd3fef02ffccd9cbbd165157849e7abff8eaa3804ba3
MD5 ebf34b66b2f992b99023e8d5f1559e21
BLAKE2b-256 580567f5e64a1403e2b80f6098c9b8bf8a8204a45a2dea31d9649c6ed21e03ab

See more details on using hashes here.

File details

Details for the file deffcode-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: deffcode-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/26.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.0.1 keyring/21.4.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for deffcode-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c710919b4df9008e5d5817c55c26a240914f75dbc63d66511c226004a04d37c
MD5 42ac6d4da204280a76a87680e884dacf
BLAKE2b-256 e4288b86c0bcb0db4b902a65de516b7f8cfe32771122f62c550ee889a75fe477

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page