I'm working on a Gstreamer project where I need to extract images from an RTSP stream. I am able to save the images from gst_parse_launch with multifilesink, but unable to add a 'listener' to the pipeline to get buffer and extract images from it.
What I have so far:
pipeline = gst_parse_launch("-e -v rtspsrc location="IPADDRESS" ! rtph264depay ! h264parse !
decodebin ! jpegenc ! appsink name=sink",
NULL);
bus = gst_element_get_bus(pipeline);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
bus = gst_element_get_bus(pipeline);
GstElement *sink = gst_bin_get_by_name(GST_BIN(pipeline), "sink");
if (!sink) {
printf("sink is NULL\n");
exit(1);
}
GstAppSink *appsink = GST_APP_SINK(sink);
if (!appsink) {
printf("appsink is NULL\n");
exit(1);
}
GstSample *sample = gst_app_sink_pull_sample(appsink);
if (!sample) {
printf("sample is NULL\n");
exit(1);
}
GstBuffer *buffer = gst_sample_get_buffer(sample);
GstMapInfo map;
gst_buffer_map(buffer, &map, GST_MAP_READ);
`
How can I do this without having to use OpenCV? (only just bytes to get image) And how can I loop through the frames being buffered in the pipeline?
Thank you in advance.