Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6367 Discussions

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

Letty
Novice
3,256 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/segmentation_demo.py

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
3,243 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?

0 Kudos
Letty
Novice
3,223 Views

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

 

0 Kudos
Vladimir_Dudnik
Employee
3,186 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.

0 Kudos
Wan_Intel
Moderator
3,150 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


0 Kudos
Reply