Skip to main content

High-performance Real-time FFmpeg based Video-Decoder 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 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:

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.1.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deffcode-0.2.1-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deffcode-0.2.1.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for deffcode-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d0eb1f59dc89d67f41c1ea36654ab9f27018cf43f87038e59401f5710db77707
MD5 57b8ffe9ce497b41c33ab76af0af8357
BLAKE2b-256 d3292cec16de8044f705189b6aa6c9955291d9bf83a7c3672e305f8988b015bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deffcode-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for deffcode-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c0f166f5636b1650e41bbc9024091ce25a63cd412c021e73786eb8403638388
MD5 4094276140728e4e883886b03f2fe68f
BLAKE2b-256 49e7deffa03a06afa3853bb393a15c68f61e2b98642d27a1f5c4321ebc32b298

See more details on using hashes here.

Supported by

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