My target is to capture video (h264) frames from RTSP source and pass it to AppSink. I have achieved this using the following :
descr = g_strdup_printf ("rtspsrc location=%s latency=0 protocols=udp-unicast ! rtph264depay ! h264parse ! omxh264dec ! nvvidconv ! "video/x-raw(memory:NVMM), format=NV12" ! appsink name=%s ", filename,sink_name);
And this is how I am grabbing from from Callback and encapsulating it in Mat
buffer = gst_sample_get_buffer (sample); gst_buffer_map (buffer, &map, GST_MAP_READ); Mat iframe(cv::Size(width, (ORIG_HEIGHT/SIZE_DIVISOR) * 3 / 2), CV_8UC1, (char*)map.data
I get segmentation fault while copying the data.
However if i remove “(memory:NVMM)” the pipeline runs fine but CPU seems super busy.
How do I use “(memory:NVMM)” in my use-case and get frame data copied to Mat or GpuMat directly or indirectly.