Skip to main content
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.

Release files for deffcode 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deffcode 0.2.0
File Size Uploaded
deffcode-0.2.0.tar.gz 29.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deffcode 0.2.0
File Interpreter ABI Platform
deffcode-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.9 kB

Release files / deffcode-0.2.0.tar.gz

Download URL deffcode-0.2.0.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3b80ce3161cad7d83737fd3fef02ffccd9cbbd165157849e7abff8eaa3804ba3
BLAKE2b-256 checksum
How to use checksums
580567f5e64a1403e2b80f6098c9b8bf8a8204a45a2dea31d9649c6ed21e03ab
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / deffcode-0.2.0-py3-none-any.whl

Download URL deffcode-0.2.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c710919b4df9008e5d5817c55c26a240914f75dbc63d66511c226004a04d37c
BLAKE2b-256 checksum
How to use checksums
e4288b86c0bcb0db4b902a65de516b7f8cfe32771122f62c550ee889a75fe477
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page