I remove the default OpenCV in Jetson tx2 and build Opencv 3.4 from source with CUDA and gstreamer.
I suppose I can use hardware acceleration to do video encoding. My source file is in H.264 and i want to convert it into HEVC format. My video file is 1224x1024 at 10fps. (The final use case is to get frame from camera)
During running the following code, I see CPU usage reach 80%. I do not think it is normal. I see the performance report of Jetson tx2 is it can encode 3-way 4K at 30fps.
May I know why cpu usage is so high, and how can I know if it use GPU to do encoding? How can I truly use GPU and lower the CPU usage?
import cv2
cap = cv2.VideoCapture('my.mkv')
gst_str = ('appsrc ! videoconvert ! omxh265enc ! mpegtsmux ! '
'filesink location={}.ts').format('test')
writer = cv2.VideoWriter(gst_str, cv2.CAP_GSTREAMER, 0, 10, (1224, 1024))
while True:
ret, frame = cap.read()
if ret !=True:
break
#cv2.imshow('REC', frame)
#if cv2.waitKey(1) == 27: # ESC key: quit program
# break
writer.write(frame)
writer.release()
cap.release()