Skip to main content

High-performance audio decoding with FFmpeg and C++

Project description

AvioFlow

AvioFlow is a high-performance audio decoding and capture library powered by FFmpeg. It provides a modern C++20 API and seamless Python bindings for efficient audio processing, including file decoding, URL streaming, and low-latency system audio capture (WASAPI/DirectShow).

Features

  • Multi-format Support: Decodes any format supported by FFmpeg (MP3, WAV, AAC, FLAC, etc.).
  • Flexible Input: Load audio from files, memory buffers, network URLs, or custom streams.
  • Hardware Capture:
    • WASAPI Loopback: Capture system output (what you hear).
    • DirectShow: Capture from microphones and other input devices.
  • Resampling: Built-in support for target sample rate and channel conversion.
  • Python Bindings: High-performance Python module using pybind11.

🛠 Build Instructions

Prerequisites

  • Windows: Visual Studio 2022+, CMake 3.20+.
  • Linux: GCC 11+, CMake 3.20+, FFmpeg development headers.

Build and Run

Use the provided PowerShell script for automated setup on Windows:

.\build.ps1

Or manually with CMake:

cmake -B build -DENABLE_PYTHON=ON -DENABLE_WASAPI=ON
cmake --build build --config Release

🚀 C++ Usage

Offline File Decoding

#include "avioflow-cxx-api.h"
#include <iostream>

int main() {
    avioflow::AudioStreamOptions options;
    options.output_sample_rate = 16000; // Resample to 16kHz
    options.output_num_channels = 1;    // Convert to Mono

    avioflow::AudioDecoder decoder(options);
    decoder.open("audio.mp3");

    auto meta = decoder.get_metadata();
    std::cout << "Codec: " << meta.codec << " Duration: " << meta.duration << "s" << std::endl;

    // Decode all at once
    auto samples = decoder.get_all_samples();
    std::cout << "Decoded " << samples.data[0].size() << " samples." << std::endl;

    return 0;
}

System Audio Capture (WASAPI)

decoder.open("wasapi_loopback");
while (!decoder.is_finished()) {
    auto frame = decoder.decode_next();
    if (!frame.data.empty()) {
        // Process real-time float samples...
    }
}

🐍 Python Usage

install command:

pip install avioflow

Basic Decoding

import avioflow 

# Initialize and open
decoder = avioflow.AudioDecoder()
decoder.open("music.wav")

# Get info
meta = decoder.get_metadata()
print(f"Container:    {meta.container}")
print(f"Codec:        {meta.codec}")
print(f"Sample Rate:  {meta.sample_rate} Hz")
print(f"Channels:     {meta.num_channels}")
print(f"Duration:     {meta.duration:.3f} s")
print(f"Num Samples:  {meta.num_samples}")

# Decode all samples, with multi-channels
print(f"\nDecoding all samples...")
samples = decoder.get_all_samples()

Real-time Capture

# List available devices
devices = avioflow.DeviceManager.list_audio_devices()
for d in devices:
    print(f"ID: {d.name}, Desc: {d.description}")

decoder = avioflow.AudioDecoder()
decoder.open("audio=@device_cm_...") # Open microphone via DirectShow string

while True:
    frame = decoder.decode_next()
    if frame:
        # data is planar float32
        process(frame.data)

License

MIT 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

avioflow-0.1.2-cp313-cp313-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.13Windows x86-64

avioflow-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

avioflow-0.1.2-cp312-cp312-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.12Windows x86-64

avioflow-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

avioflow-0.1.2-cp311-cp311-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.11Windows x86-64

avioflow-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

avioflow-0.1.2-cp310-cp310-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.10Windows x86-64

avioflow-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

avioflow-0.1.2-cp39-cp39-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9Windows x86-64

avioflow-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

avioflow-0.1.2-cp38-cp38-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.8Windows x86-64

avioflow-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

File details

Details for the file avioflow-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: avioflow-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avioflow-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0f7b75b97b03ffc10c41bc20b5843bcf4185359cf86dfbd8f63208cb4c8b5f9d
MD5 bf1cf7a7fbbc77d8e37b9e0e6765c293
BLAKE2b-256 f42f8e0fe5deca6a468dbb63e38698e33c3e7aa5699aa315642b21daecad554d

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for avioflow-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e72fb81e54a0c0af19f0920f7350e8d581968eead4b88ea1de9f5b3483222c32
MD5 24c55472d3a808a992228fd9ff62a54d
BLAKE2b-256 6dee863f58065ee0ab6adeb10cd86b11c29c7648cc3cab7f6d3862755ff66c75

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: avioflow-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avioflow-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3f912fafadebcc83695d5a5ec8bbbc5ed36088ab2dca9e91a271c040b2760706
MD5 3cbc98a77abc5c5a3da2ded77b8e96cb
BLAKE2b-256 2a6b4bc11ab39c217c9829cb3be868ace6a93f134a0e36c2ab4c0e2c4d8ff2d2

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for avioflow-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aae39ac7fc4ccf94c957c6e8b2aca7ee94ee55d9df53d675eb78873fed3ea180
MD5 9792ab1a15f1c724b174193cf2711de9
BLAKE2b-256 8667fc23b1e0f987783179744d6fd2bcfefe7c3271a52e14fca404c5c2ac2e87

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: avioflow-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avioflow-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 259c070a5dd6571a5db4b4bee0c7feb2bee0d2d952ac8fddec054a8caf5ffb09
MD5 4c088cc826db2fb512e40f28ef19ebd7
BLAKE2b-256 46f0912bf0c5a567137422db4c5ed36333c2fea0125c9ab37d8dbeb64be449cd

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for avioflow-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7e94c6bdd0fff262d1fc1e06ba8ebe6a921bacca88eacef733fb7d9c7fe2af0d
MD5 2cd43396b3b251ebd71adddb6539a98e
BLAKE2b-256 5961a0e69e73a97f109d3f6c647f4a803dfcb5daf4caeabea0a872e84950f9d0

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: avioflow-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avioflow-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cc0fd9d5845f35c7d70c3f2e5c982ed36724c2ecf6b1a41aa32f2af41951dbaa
MD5 7210193ed4ff12f036cce020c21e4633
BLAKE2b-256 24333701018b3ad7ed45464b1164c43f357edbb278292b1477355a701d414634

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for avioflow-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b09e22b6bee7f0d39ab51bca86f719c0308cd4b5382e13b57607a16b0386acfd
MD5 fa2b11d88fce65359150f51e52481ca0
BLAKE2b-256 fc1eaa7534d327e5a456d5ad7b23c421d12ca8a08b44adf17d1e94053453ba38

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: avioflow-0.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avioflow-0.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fe27f46ab8e0478e7fefc03e10998674161d023b1d9935ddfe54cee5efb438e7
MD5 804fd7a34fb9dfdc28cb8476c87b4ae9
BLAKE2b-256 7530e6142c8ee2fef8070286be8bebf4b289d0376df0ecd4f6d27120c32ca224

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for avioflow-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e86261181bf3981d08afb7e3f316c4edb7f26b5342b236e79b4fae807abfba74
MD5 422ada694ddb73ef7d413de5c04d041e
BLAKE2b-256 f44fbeff0bfebea4e91c7b8cecb5b804bafe7cf081d4235a99e1da540a0d0442

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: avioflow-0.1.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for avioflow-0.1.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7ea136718261b8ebf69aba0fe11d4e604de6c5a4d34f4d9ac71162888bd90ded
MD5 8186a98d789d3771b1f07f7f67052fd0
BLAKE2b-256 3ffc75f9c59de21685a895df7aad5478350f143221c532146d2014725212f552

See more details on using hashes here.

File details

Details for the file avioflow-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for avioflow-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e1ceb42c13af23163152214ce9bb366c4a11eb7fb44fc876dd2466fb43e78324
MD5 fbd626dc131b0cc5091baef09bda88a8
BLAKE2b-256 4ce739a595569a5a979d6fe133ee5e63fb41336b0b60f87f30c18d447db2e9c1

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