Babit Multimedia Framework (BMF)
website·Indexed 30 days ago
https://babitmf.github.io/docsA cross-platform, multi-language, customizable multimedia processing framework with strong GPU acceleration. BMF supports C++, Python, and Go interfaces, offering features such as dynamic graphs, GPU hardware transcoding via NVIDIA, and TensorRT-accelerated DL inference. It is fully compatible with FFmpeg and provides various execution modes including Sync, Generator, Preload, and PushData.
What's inside BMF
- BMF is fully compatible with FFmpeg's capabilities, allowing users in Python, C++, and Go to leverage FFmpeg's rich feature set for AV demuxing, decoding, filtering, encoding, and muxing through BMF's built-in modules and flexible API. It requires the FFmpeg library to be installed on the system.
Overview of BabitMF (BMF) Core Concepts
BabitMF (BMF) is a general video processing framework that uses a modular approach to manage atomic video processing capabilities. It organizes processing steps into a Directed Acyclic Graph (DAG) where data flows between modules.
Key concepts include:
- Graph: A DAG developed via the interface layer that represents a runnable pipeline or application.
- Module/Node: An atomic video processing capability. A Module is the definition (which can be built-in or developed via SDK), and a Node is an instantiated Module.
- Stream: The connection between nodes that defines the path of data transmission.
- Packet: The universal data carrier in BMF. All data types (e.g., VideoFrame, AudioFrame) are encapsulated into Packets to be passed between modules.
- Task: The scheduling unit used by the BMF engine to dispatch processing work to the
process()entry of modules.
Overview of Babit Multimedia Framework (BMF)
BMF (Babit Multimedia Framework) is a cross-platform, multi-language, customizable multimedia processing framework developed by ByteDance. It allows developers to build high-performance multimedia processing links using graphs or pipelines, or by directly invoking individual processing capabilities. It is designed for scenarios such as video transcoding, frame extraction, enhancement, analysis, editing, video conferencing, and VR.Overview of BMF Dynamic Graph
The Dynamic Graph feature in BMF allows developers to modify the graph structure (adding, removing, or configuring nodes) at runtime. This process is designed to occur without blocking other running nodes and with minimal performance penalty. To identify specific nodes for dynamic operations, analiastag should be assigned to modules during graph construction.Overview of Babit Multimedia Framework (BMF)
Babit Multimedia Framework (BMF) is a cross-platform multimedia processing framework designed for high-performance scheduling of DAGs, Graphs, and Pipelines. It is fully compatible with FFmpeg functions and standards, including demuxing, decoding, filtering, encoding, and muxing. BMF decouples processing algorithms from the project structure via a module-based system, allowing for high scalability and diversified collaboration.Overview of Babit Multimedia Framework (BMF)
Babit Multimedia Framework (BMF) is a cross-platform, multi-language, and customizable multimedia processing framework developed by ByteDance. It is designed for high-scale production environments and is used for video streaming, live transcoding, cloud editing, and mobile pre/post processing.Overview of bmf_sdk::Future
Thebmf_sdk::Futureclass is used to track the readiness of data and manage synchronization between the CPU and device (e.g., GPU). It allows developers to record events and check if a result is ready before accessing it.Build BMF from source on macOS
Building on macOS requires FFmpeg and specific dependencies based on architecture. For ARM (M1/M2), Python 3.9-3.12 is recommended. You must manually installbinutilsandlibncursesas they are required forlibbfd.# Install libncurses ./configure --prefix=/usr/local/opt/ncurses make sudo make install # Install binutils for libbfd wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.bz2 tar xvf binutils-2.43.1.tar.bz2 cd binutils-2.43.1 ./configure --prefix=/usr/local/opt/binutils --enable-install-libiberty make -j8 sudo make installInstall BMF via pip
BMF can be installed using pip. Python versions 3.6 to 3.12 are supported, though versions lower than 3.6.15 are not recommended as they may cause compilation failures. For users on x86_64 architecture with CUDA 12.2 installed, a GPU-specific version is available.# Standard installation pip install BabitMF # GPU version (x86_64 with CUDA 12.2) pip install BabitMF-GPUBMF Architecture and Language Support
BMF is organized into three layers to support multi-language development and scalability:
- Application Layer: Provides APIs in Python, Go, and C++ for project integration.
- Framework Layer: Handles graph/pipeline scheduling, cross-data type and cross-device data transfer backends, and SDKs for reformatting, color space conversion, and tensor operators.
- Module Layer: Contains atomic video processing capabilities. Modules can be developed independently in Python, Go, or C++, decoupling the algorithm implementation from the application layer.
Use the Exception class for error handling in BMF C++
TheExceptionclass encapsulates detailed information about errors occurring within a BMF program. While it has a full constructor, it is typically not called explicitly by the developer; instead, exceptions are constructed and thrown implicitly using theBMF_Error()andBMF_Error_()macros.Create an AudioFrame instance
Thebmf_sdk::AudioFrameclass can be instantiated using constructors or staticmakemethods. You can create a frame by specifying the number of samples and layout, or by providing an existingTensorListof data.// Create an empty frame with specific samples and layout bmf_sdk::AudioFrame frame1(int samples, uint64_t layout, bool planer = true, const TensorOptions &options = kUInt8); // Create a frame from existing TensorList data bmf_sdk::AudioFrame frame2(const TensorList &data, uint64_t layout, bool planer = true); // Using static make methods auto frame3 = bmf_sdk::AudioFrame::make(int samples, uint64_t layout, bool planer = true); auto frame4 = bmf_sdk::AudioFrame::make(const TensorList &data, uint64_t layout, bool planer = true);