Nvvideoconvert dynamic crop - caps renegotiation

Hello Community,

First of all, here is my current setup:

• Hardware Platform: Tx2
• DeepStream: 5.1
• JetPack: 4.5
• TensorRT: 7.1
• Issue Type: question

I am working on a simple, custom application that saves the input from the camera to the files - one is original input, second a crop of the original input. Input is some 4K stream from the camera. Pipeline goes sth like this:
*nvarguscamerasrc* -> ... -> *tee* -> two branches to separate *filesrc*'s each
Branch 1 makes no changes to the video and saves it to the file.
Branch 2 crops region of the video (always 1080p) and saves it to the file.

To be exact branch 2 looks like so:
queue -> nvvideoconvert -> nvvideoconvert -> capsfilter -> nvv4l2h264enc -> h264parse -> qtmux -> filesink

When I use nvvideoconvert element (first one), set “src-crop” property before running the pipeline, I have no issues. Please note that second nvvideoconvert already has capsfilter that forces caps to be 1080p always on the output. Problems occur when I want to change the aforementioned property during the runtime, let’s say in a pad probe after 30 frames has passed. I am fully aware that I need to set element in READY state, get state from gst_element_get_state function to assure that state was changed, change property and change state to PLAYING again (no issues with state changes whatsoever). Problem is that after such change I get:

0:00:02.743816268 31493   0x559b08ea30 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<nvarguscamerasrc0> error: Internal data stream error.
0:00:02.743908617 31493   0x559b08ea30 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<nvarguscamerasrc0> error: streaming stopped, reason not-negotiated (-4)
0:00:02.744338718 31493   0x559b08ea30 WARN                   queue gstqueue.c:988:gst_queue_handle_sink_event:<queue> error: Internal data stream error.
0:00:02.744395484 31493   0x559b08ea30 WARN                   queue gstqueue.c:988:gst_queue_handle_sink_event:<queue> error: streaming stopped, reason not-negotiated (-4)
Error: Internal data stream error.

(queue is right after nvarguscamerasrc0)

Clearly this is caps negotiation problem. Therefore question is: how to force caps renegotiation on elements both downstream and upstream (since it changes caps between both nvvideoconvert elements as well) after changing “src-crop” property on first nvvideoconvert? What is the solution to change the property dynamically in the element?

I’ve tried a lot of combinations, trust me, but still, maybe someone already tacked such issue?

All the best!
Tom

Please use “gst-inspect-1.0 nvvideoconvert” command to check the information of the plugin.

You will find "flags: readable, writable, changeable only in NULL or READY state" for the “src-crop” property.

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