Create a Graph

This page describes the basic usage of BMF. To start, you need to build a graph:

import bmf

graph = bmf.graph()

After the Graph is initialized, decode the input video:

video = graph.decode({
     "input_path": input_video_path

Separate the previously decoded video['video'] and video['audio'] for transcoding, and run will start to validate and execute the entire graph Build and execute. Output a video file after completion:

         "output_path": output_path,
         "video_params": {
             "codec": "h264",
             "width": 320,
             "height": 240,
             "crf": 23,
             "preset": "veryfast"
         "audio_params": {
             "codec": "aac",
             "bit_rate": 128000,
             "sample_rate": 44100,
             "channels": 2

Last modified February 19, 2024 : fix baidu statistics (daa0758)