Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5928 Discussions

Improve speed of OpenCV VideoWriter (async video read and write)

Letty
Novice
939 Views

Hi, I am currently performing semantic segmentation in Python based on the demo example https://github.com/openvinotoolkit/open_model_zoo/blob/2021.3/demos/segmentation_demo/python/segment...

I am processing a pre-recorded video at 30fps and saving the results into a video with cv2.VideoWriter. I noticed that the video writing operation seems to be too slow to run smoothly at 30fps, in the sense that some frames in the input video are skipped and not read. If I use an input video with a lower fps (e.g. 15fps) everything works fine.

Since the example code is already using an async pipeline, is there any way that the reading and writing of the frames can be async? Or is there a way to improve the performance of the video writing process?

I am not too familiar on how the async pipeline works and if it can be modified, so I'm not sure on how to proceed

 

0 Kudos
4 Replies
Vladimir_Dudnik
Employee
927 Views

@Letty could you please try segmentation demo in OpenVINO 2021.4 which is the latest available release at the moment, to see if there are any changes in performance?

Letty
Novice
907 Views

Thank you @Vladimir_Dudnik. I tried but the performance is the same.

 

Vladimir_Dudnik
Employee
870 Views

@Letty OMZ demos use OpenCV to process media files (for input and for output), which in its turn use various media backends available in the system (ffmpeg, microsoft media foundation, intel media sdk and so on). I do not know what is your target operating system and what media backend selected by OpenCV on your system, might be it is not optimal. Definitely, application could be written in more efficient way, but in this case you'll have to know how to implement asynchronous processing and how to use hardware acceleration for media decoding or encoding.

Wan_Intel
Moderator
834 Views

Hi Letty,


This thread will no longer be monitored since Vladimir_Dudnik had provided explanations and suggestions.

If you need any additional information from Intel, please submit a new question.


Regards,

Wan


Reply