Hello, I want to dynamically switch the resolution in the pipeline below, but the ability of appsrc
keeps failing.
appsrc ! h264parse ! capsfilter ! nvv4l2decoder ! appsink
// The initial settings of appsrc are as follows
g_object_set(data_info.appsrc ,
"caps" , gst_caps_new_simple(
"video/x-h264" ,
"stream-format" , G_TYPE_STRING , "byte-stream" ,
"width" , G_TYPE_INT , width ,
"height" , G_TYPE_INT , height ,
"framerate" , GST_TYPE_FRACTION , 30 , 1 ,
NULL) ,
"format" , GST_FORMAT_TIME ,
"is-live" , TRUE ,
"max-bytes" , 0 ,
NULL);
Since the resolution of my device when switching the camera’s photo or video mode is 1080 and 1440 respectively, when the data reaches Appsrc
, I failed to switch caps
through the code below. The element nvv4l2decoder
has been confirmed by nvidia
to support dynamic switching, so now I want to know how appsrc
can dynamically switch its capabilities.
auto app_caps = gst_caps_new_simple(
"video/x-h264" ,
"stream-format" , G_TYPE_STRING , "byte-stream" ,
"width" , G_TYPE_INT , width ,
"height" , G_TYPE_INT , height ,
"framerate" , GST_TYPE_FRACTION , 30 , 1 ,
NULL);
auto sample = gst_sample_new(data_info.gst_buffer , app_caps , NULL , NULL);
gst_app_src_push_sample(GST_APP_SRC(appsrc) , sample);
The exception is as follows:
ERROR from element appsrc_one: Internal data stream error.
nvstreammux: Successfully handled EOS for source_id=0
Error details: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:resolution_test/GstAppSrc:appsrc_one:
streaming stopped, reason not-negotiated (-4)