AGX Orin nvv4l2h264enc lossless compression unable to fixate caps

Hello

I am trying to enable lossless compression in nvv4l2h264enc in Jetson AGX Orin jetpack 5.1.2 using the following GStreamer pipeline

GST_DEBUG=2 gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! "video/x-raw(memory:NVMM),format=UYVY,width=1920,height=1080,framerate=30/1,interlace-mode=progressive" ! queue ! nvvidconv ! "video/x-raw(memory:NVMM),width=960,height=540,format=Y444,interlace-mode=progressive" !  nvv4l2h264enc enable-lossless=true ! h264parse ! qtmux ! filesink location=vid.mp4 -e

However I am seeing the following errors

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
0:00:00.193409767  6386 0xaaaae3edc830 WARN                    v4l2 gstv4l2object.c:2420:gst_v4l2_object_add_interlace_mode:0xaaaae3eb6680 Failed to determine interlace mode
0:00:00.193460679  6386 0xaaaae3edc830 WARN                    v4l2 gstv4l2object.c:2420:gst_v4l2_object_add_interlace_mode:0xaaaae3eb6680 Failed to determine interlace mode
0:00:00.193480615  6386 0xaaaae3edc830 WARN                    v4l2 gstv4l2object.c:2420:gst_v4l2_object_add_interlace_mode:0xaaaae3eb6680 Failed to determine interlace mode
0:00:00.193497256  6386 0xaaaae3edc830 WARN                    v4l2 gstv4l2object.c:2420:gst_v4l2_object_add_interlace_mode:0xaaaae3eb6680 Failed to determine interlace mode
0:00:00.193546152  6386 0xaaaae3edc830 WARN                    v4l2 gstv4l2object.c:4561:gst_v4l2_object_probe_caps:<nvv4l2h264enc0:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
0:00:00.194839435  6386 0xaaaae3ec8700 WARN         nvv4l2camerasrc gstnvv4l2camerasrc.cpp:684:gst_nv_v4l2_camera_fixate:<nvv4l2camerasrc0> Unable to fixate caps structure
New clock: GstSystemClock
0:00:00.373269896  6386 0xaaaae3ec86a0 WARN            videoencoder gstvideoencoder.c:685:gst_video_encoder_setcaps:<nvv4l2h264enc0> rejected caps video/x-raw(memory:NVMM), width=(int)960, height=(int)540, interlace-mode=(string)progressive, framerate=(fraction)30/1, format=(string)Y444
Redistribute latency...
0:00:00.373428904  6386 0xaaaae3ec86a0 WARN            videoencoder gstvideoencoder.c:685:gst_video_encoder_setcaps:<nvv4l2h264enc0> rejected caps video/x-raw(memory:NVMM), width=(int)960, height=(int)540, interlace-mode=(string)progressive, framerate=(fraction)30/1, format=(string)Y444
0:00:00.373442824  6386 0xaaaae3ec86a0 WARN                GST_PADS gstpad.c:4231:gst_pad_peer_query:<capsfilter1:src> could not send sticky events
Redistribute latency...
0:00:00.402153594  6386 0xaaaae3ec86a0 WARN            videoencoder gstvideoencoder.c:685:gst_video_encoder_setcaps:<nvv4l2h264enc0> rejected caps video/x-raw(memory:NVMM), width=(int)960, height=(int)540, interlace-mode=(string)progressive, framerate=(fraction)30/1, format=(string)Y444
Redistribute latency...
0:00:00.410425650  6386 0xaaaae3ec86a0 WARN            videoencoder gstvideoencoder.c:685:gst_video_encoder_setcaps:<nvv4l2h264enc0> rejected caps video/x-raw(memory:NVMM), width=(int)960, height=(int)540, interlace-mode=(string)progressive, framerate=(fraction)30/1, format=(string)Y444
Redistribute latency...
0:00:00.437735775  6386 0xaaaae3ec8700 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<nvv4l2camerasrc0> error: Internal data stream error.
0:00:00.437769887  6386 0xaaaae3ec8700 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<nvv4l2camerasrc0> error: streaming stopped, reason not-negotiated (-4)
0:00:00.437881696  6386 0xaaaae3ec8700 WARN                   queue gstqueue.c:988:gst_queue_handle_sink_event:<queue0> error: Internal data stream error.
0:00:00.437910592  6386 0xaaaae3ec8700 WARN                   queue gstqueue.c:988:gst_queue_handle_sink_event:<queue0> error: streaming stopped, reason not-negotiated (-4)
ERROR: from element /GstPipeline:pipeline0/GstNvV4l2CameraSrc:nvv4l2camerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvV4l2CameraSrc:nvv4l2camerasrc0:
streaming stopped, reason not-negotiated (-4)
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
ERROR: from element /GstPipeline:pipeline0/GstQueue:queue0: Internal data stream error.
Additional debug info:
gstqueue.c(988): gst_queue_handle_sink_event (): /GstPipeline:pipeline0/GstQueue:queue0:
streaming stopped, reason not-negotiated (-4)
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Interrupt while waiting for EOS - stopping pipeline...
Execution ended after 0:00:02.316497373
Setting pipeline to NULL ...
Freeing pipeline ...

Do you have any advice on how to convert to Y444 to enable losless compression?

Hi,
Please try H265 encoding:

$ gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! "video/x-raw(memory:NVMM),format=UYVY,width=1920,height=1080,framerate=30/1,interlace-mode=progressive" ! queue ! nvvidconv ! "video/x-raw(memory:NVMM),width=960,height=540,format=NV24,interlace-mode=progressive" !  nvv4l2h265enc enable-lossless=1 ! h265parse ! qtmux ! filesink location=vid.mp4 -e

For H264 lossless encoding, it works in jetson_multimedia_api but there is issue in gstreamer. Please check
Lossless encoding - #3 by DaneLLL

If you need both encoding and decoding, we would suggest use H265.

1 Like

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