bmf icon indicating copy to clipboard operation
bmf copied to clipboard

CPU Video Frame Extraction

Open RoyaltyLJW opened this issue 1 year ago • 5 comments

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

RoyaltyLJW avatar Sep 08 '23 09:09 RoyaltyLJW

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

xiaoweiw-nv avatar Sep 08 '23 09:09 xiaoweiw-nv

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

RoyaltyLJW avatar Sep 08 '23 10:09 RoyaltyLJW

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?

RoyaltyLJW avatar Sep 08 '23 10:09 RoyaltyLJW

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.

HuHeng avatar Sep 08 '23 10:09 HuHeng

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

RoyaltyLJW avatar Sep 08 '23 15:09 RoyaltyLJW