Improving OpenCV videowritter performance in Jetson TX2

Hey everyone!

I have an Gstreamer program that streams 1080p video to clients using webrtbin and before sending it processes it with OpenCV. The video stream works great by converting the buffer to gpumat (tried appsrc and appsink with videowriter but everything was really slow).

My problem is that the program requires that sometimes the user request the video to be saved and I tried implementing it by opening a videowriter that puts every frame extracted from the buffer into a file. My issue comes from videowriter performance, the program works, but when recording the framerate drops from 30fps to barely 5fps and I’m guessing this is because of the cpu-based nature of opencv encoders (same reason I had to drop appsrc)

Is there a way to make the videowriter not take so much time? I thought to make a pipeline read the client webrtc stream and encodes into a video but I haven’t managed to get a pipeline that succesfully decodes udp-vp8 and encodes to video.

Thanks!

Hi,
A topic might help:


Not sure how cv2.VideoWriter() works, but looks like you can run the pipeline to levergage hardware encoding. Please give it a try.