Change resolution /framerate on the fly gstreamer pipeline

Hello,

I have write a pipeline in c++ that connects to camera and write image. I want to update resolution and framerate during pipeline in running state.

gst-launch-1.0 nvarguscamerasrc sensor-id=1 sensor-mode=3 \
! 'video/x-raw(memory:NVMM), width=3840, height=2160, format=(string)NV12, framerate=(fraction)30/1' \
! nvvidconv  ! nvjpegenc  ! multifilesink location=test%d.jpg

I tried to add filter object, between src and nvvidconv but it gave an error.

caps = gst_caps_from_string(“video/x-raw(memory:NVMM) , width=1920, height=1080, format=(string)NV12, framerate=(fraction)10/1”);
g_object_set(G_OBJECT(filter), “caps”, caps, NULL);
gst_caps_unref(caps);

Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:543

I have also tried to stop pipeline with this command.
gst_element_send_event(pipeline, gst_event_new_eos())
then succesfult restart same pipeline with new framerate value but when I tried to update frame rate again, this time it didn’t stopped.

What is the proper way of updating frame rate and width height values?
By the way, I can update all nvarguscamerasrc parameters on the fly without any problem.

caps Set the filter properties and select the appropriate stream. Changing the width, height and frame rate requires plugins with writable properties, such as videoconvert, videoscale, and videorate.

Thank you for your response @guo.chsh. I changed nvvidconv to videoconvert according to your mention.

This is the way I linked the source and videoconvert.
gst_element_link_many(source, capsfilter, videoconvert,NULL)

After running the pipeline I update the fps value with this.
configuration->fps = fps; caps = gst_caps_new_simple("video/x-raw",
   "format", G_TYPE_STRING, "NV12",      "framerate", GST_TYPE_FRACTION, configuration->fps, 1,
   "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
   "width", G_TYPE_INT, configuration->width,
   "height", G_TYPE_INT, configuration->height,
    NULL);

auto feature = gst_caps_features_new("memory:NVMM", NULL);
gst_caps_set_features(caps, 0, feature);    g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);

it again gave the same error like in nvvidconv
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:543 Failed to create CaptureSession

I also tried to add another caps to the rightside of videoconvert and try to update it ,
gst_element_link_many(videoconvert,capsfilter2, tee, NULL)
then it gave this error
ERROR from element argus-source: Internal data stream error.
Error details: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:test-pipeline/GstNvArgusCameraSrc:argus-source:
streaming stopped, reason not-negotiated (-4)

Hi,
It is not possible to change the resolution of source in runtime. You would need to terminate and reinitialize the pipeline.