How gst_caps_new_simple is different from gst_caps_to_string

I was adding caps for the capsfilter element if i use the gst_caps_to_string function it is working fine , and if i use the gst_caps_new_simple function it is throwing error

(test:5850): GStreamer-CRITICAL **: 12:32:36.700: gst_structure_new_valist: assertion ‘gst_structure_validate_name (name)’ failed

(test:5850): GStreamer-CRITICAL **: 12:32:36.700: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed
testing the application
Using winsys: x11
model warmup 10 times
model warmup 10 times
testing the application 312Received new pad ‘video_0’ from ‘demuxer’:
Link succeeded (type ‘video/x-h264’).
Received new pad ‘audio_0’ from ‘demuxer’:
We are already linked. Ignoring.
NvMMLiteOpen : Block : BlockType = 261
NvMMLiteBlockCreate : Block : BlockType = 261

(test:5850): GStreamer-CRITICAL **: 12:32:38.006: gst_clock_get_time: assertion ‘GST_IS_CLOCK (clock)’ failed
terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(4.8.0) /home/ubuntu/opencv_build/opencv/modules/core/src/matrix.cpp:434: error: (-215:Assertion failed) _step >= minstep in function ‘Mat’

Aborted (core dumped)

Gstreamer version: 1.20.3

if i use capsfilter = gst_element_factory_make(“capsfilter”, “caps-filter”);
GstCaps caps ;
caps= gst_caps_from_string(“video/x-raw(memory:NVMM), format=RGBA”);

g_object_set(G_OBJECT(capsfilter), “caps”, caps, NULL);

it is working fine if i use this am getting error…

capsfilter = gst_element_factory_make(“capsfilter”, “caps-filter”);
caps = gst_caps_new_simple(“video/x-raw(memory:NVMM)”, “format”, G_TYPE_STRING, “RGBA”, NULL);
g_object_set(G_OBJECT(capsfilter), “caps”, caps, NULL);