Hello.
I need to save a high fps video, and get access to frames with python in real time for showing a preview with pygame or something similar.
I´m trying something like this:
cap = cv2.VideoCapture('v4l2src device=/dev/video0 ! image/jpeg, width=1920, height=1080, framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! tee name=t t. ! omxh264enc control-rate=2 bitrate=20000000 ! queue ! mux. alsasrc ! audio/x-raw,width=16,depth=16,rate=32000,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=/home/ances/Desktop/videos/v0.mp4 sync=True t. ! appsink ', cv2.CAP_GSTREAMER)
But I have errors, like this:
NvMMLiteOpen : Block : BlockType = 277
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 277
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
I tried saving images and video simultaneously, hoping for reading the images with python:
gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg, width=1920, height=1080, framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! tee name=t t. ! omxh264enc control-rate=2 bitrate=20000000 ! queue ! mux. alsasrc ! audio/x-raw,width=16,depth=16,rate=32000,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=/home/ances/Desktop/videos/v0.mp4 sync=True t. ! queue ! jpegenc ! multifilesink location="/home/ances/Desktop/videos/frame%06d.jpg" max-files=300 -e
But the video fps decreases dramatically.
I don´t need the highest fps preview, but it is important to save the video with the highest fps.
Could anyone suggest any ideas?
Thanks.