Problem opening gstreamer VideoWriter

Hi there

I am unable to open a VideoWriter with an appsrc gstreamer pipeline. The following code always fails (OpenCv-4.5.2)

using namespace cv;
	
VideoWriter* _writerUdp = new VideoWriter();
_writerUdp->open("appsrc ! videoconvert ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=8553",
	CAP_GSTREAMER,
	0,
	(double)30,
	Size(640, 480),
	true);
if (!_writerUdp->isOpened())
{
	return "Unable to open output UDP stream for writing";
}

I am pretty sure I have the correct options compiled into OpenCV as elsewhere in the app I successfully open a udpsrc gstreamer pipeline in a VideoCapture.

Can anyone point me in the right direction as to what I’ve missed here?

Thanks
Mark

welcome.

define “fails”.

contemporary C++ should look like this, i.e. no pointers and no new/delete

cv::VideoWriter writerUdp {
	"appsrc ! videoconvert ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=8553",
	cv::CAP_GSTREAMER, // apiPreference
	0, // fourcc
	30, // fps
	cv::Size{640, 480}, // frameSize
	true }; // isColor

if (!writerUdp.isOpened())
	// ...

Thanks for the tip about pointers etc. At my day job I work in C# and haven’t used C/C++ for a long time.

When I say “fails” I mean the writer fails to open, _writerUdp->isOpened() is always false.

Thanks again

std::cout << cv::getBuildInformation()