Hi, I try make video recorder with Jetson nano. I tried capture video use command-line:
gst-launch-1.0 nvarguscamerasrc num-buffers=1200 gainrange="1 1" ispdigitalgainrange="2 2" ! 'video/x-raw(memory:NVMM),width=1280, height=720, framerate=120/1, format=NV12' ! omxh264enc ! qtmux ! filesink location=test.mp4 -e
Everything works, but I can’t control start\stop record.
So,I try use OpenCv to control record from camera, use this sample:
def gstreamer():
return ('nvarguscamerasrc gainrange="1 1" ispdigitalgainrange="2 2" ! '
'video/x-raw(memory:NVMM), '
'width=1280, height=720, '
'format=(string)NV12, framerate=120/1 ! '
'nvvidconv flip-method=0 ! '
'video/x-raw, width=1280, height=720, format=(string)BGRx ! '
'videoconvert ! '
'video/x-raw, format=(string)BGR ! appsink')
cap = cv2.VideoCapture(gstreamer(), cv2.CAP_GSTREAMER)
fourcc = cv2.VideoWriter_fourcc(*"X264")
writer = cv2.VideoWriter("out/{}".format(name), fourcc, 30, (1280, 720), True)
if cap.isOpened():
for i in range(120):
ret_val, img = cap.read()
writer.write(img)
writer.release()
cap.release()
I can start\stop recoding, but X264 codec in OpenCV work slow on Jetson, I can take only 10 FPS.
How I can write stream from command line sample already code in h264 to file?