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:

bmf.encode(
     video['video'],
     video['audio'],
     {
         "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
         }
     }
)
     .run()

Last modified December 16, 2024 : Fix binutils install doc on macOS (#28) (67b861f)