Disable blocking mode in encoding with opencv-gstreamer and nvv4l2h264enc

I’m trying to encode video stream from appsrc in python opencv-gstreamer (Jetpack 4.4.1). Using pipeline appsrc | videoconvert ! omxh264enc ! qtmux ! filesink location=test.mp4 I occassionally run into this issue,

NvMMLiteVideoEncDoWork: Surface resolution (1 x 393216) smaller than encode resolution (640 x 360)                              
VENC: NvMMLiteVideoEncDoWork: 4283: BlockSide error 0x4 
Event_BlockError from 105BlockAvcEnc : Error code - 4
Sending error event from 105BlockAvcEnc[ 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 omxh264enc-omxh264enc105 reported: GStreamer encountered a general supporting library error.  

Having read in other posts that omx plugins are deprecated since r32.2, I tried to use nvv4l2h264enc with pipeline appsrc | videoconvert ! nvvidconv ! nvv4l2h264enc ! h264parse ! qtmux ! test.mp4 . It works, but blocks other threads/ops in my app, which doesn’t happen with the omxh264enc pipeline.

Even when using cmd line, gst-launch-1.0 videotestsrc ! 'video/x-raw,width=(int)640,height=(int)480,format=(string)I420' ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvv4l2h264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=test.mp4 -e , it says “Opening in BLOCKING MODE”, where as the equivalent pipeline with omx plugin doesn’t open in blocking mode.

My question is, if there is a way to open the stream/pipeline in non-blocking mode?

By default it is blocking mode in gstreamer and jetson_multimedia_api. In jetson_multimedia_api, you can set to non-blocking mode. In gstreamer, we would suggest use blocking mode since it is the mode verified in SQA tests. If you have to use non-blocking mode in gstreamer, one possible solution is to do customization by referring to jetson_multimedia_api. The source code of gst-v4l2 is public so you can do customization.

By “it is blocking mode”, do you mean nvv4l2h264enc is blocking? Because it isn’t blocking with the omx plugin. If so, could you please point me to the source code of gst-v4l2?

Please download the package:
Jetson Linux | NVIDIA Developer
L4T Driver Package (BSP) Sources

All source code is in the package. Please download it and take a look.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.