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
816 stars 71 forks source link

CPU Video Frame Extraction #58

Open RoyaltyLJW opened 1 year ago

RoyaltyLJW commented 1 year ago

Hi,I want to use BMF to extract video (yuv420p) frame with cpu, using demo shown in https://babitmf.github.io/docs/bmf/multiple_features/graph_mode/generatemode/ with generator mode. But It seems that it use more time than ffmpeg-python. Is there any way to speed it up? and which demo can i refer? Thanks

xiaoweiw-nv commented 1 year ago

We have a frame extraction demo which uses GPU (nvJPEG) to encode jpeg, have you tried that?

RoyaltyLJW commented 1 year ago

Thanks, I will try it. Is it can run in cpu?

RoyaltyLJW commented 1 year ago

It seems that it use encode module to save the frame in JPEG format, but i do not want to save it as a file. Instead, I want to get the frame content, for example, numpy array for further analysis, just like demo shown in generate_mode. Are there some other demos are suggested?

HuHeng commented 1 year ago

Are the ffmpeg versions used in your BMF environment and ffmpeg-python consistent? BMF builtin module ffmpeg-decoder use libavcodec for decoding. If the underlying decoding is done using ffmpeg, they should not differ significantly. Are you running it in our runtime environment? Perhaps the ffmpeg provided by our runtime environment does not have some optimized compilation options, but this should not affect the testing. There are many demos in our repo include the functionality of decoding and converting to an RGB24 numpy array.

RoyaltyLJW commented 1 year ago

Thanks a lot, the ffmpeg version I test with two ways is the same. I will try it later