0

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.

Grizzly
  • 3
  • 1
  • 4
  • IT is not exactly clear to me what you are trying to do. Remove the `jpegenc` from your pipeline and you will get the raw image data instead? – Florian Zwoch Nov 17 '19 at 11:03
  • @FlorianZwoch I was trying to get the raw data from this stream, got it working with map.data, where I saved it to an array of bytes and now I have the full image. Thank you! – Grizzly Nov 19 '19 at 15:25

0 Answers0