BabitMF / bmf

Cross-platform, customizable multimedia/video processing framework. With strong GPU acceleration, heterogeneous design, multi-language support, easy to use, multi-framework compatible and high performance, the framework is ideal for transcoding, AI inference, algorithm integration, live video streaming, and more.
https://babitmf.github.io/
Apache License 2.0
810 stars 71 forks source link

In bmf.encode, how do you set the parameters of color space #83

Closed lxllsl closed 10 months ago

lxllsl commented 11 months ago

set output color space: ffmpeg -i test.mp4 -vf "scale=960:540:out_color_matrix=bt709:flags=lanczos" out.mp4

sfeiwong commented 11 months ago

please refer the sample code as below:

    my_graph = bmf.graph({'dump_graph': 1})
    decode_stream = my_graph.decode({'input_path': input_video_path})

    scaled_stream = bmf.module([decode_stream['video']], "c_ffmpeg_filter", option={
                'name': 'scale',
                'para': 'w=960:h=540:out_color_matrix=bt709:flags=lanczos'})

    (bmf.encode(scaled_stream, None, {
            "output_path": "out.mp4"
        }).run())