Grabbing Last Frame from Live H264 Stream and Converting It to an Image
mallocmadness
onur at agilitycorp.com
Thu Oct 19 17:58:34 UTC 2017
Hi,
I have a multifilesink that’s linked to GstMatroskaMux, I’m trying to take a
snapshot by grabbing the last-sample, which if I understand correctly will
be the last frame. However I can’t seem to get it work.
Basically I was trying to feed the lastFrame I grabbed into
gst_video_convert_sample with caps set to png and feed that sample into
gst_video_convert_sample, however, I’m getting "Could not convert video
frame: Internal data stream error.” Which doesn’t tell me much.
For you convenience here’s a sample code of what I’m trying to do:
//GstSample *lastFrameSample;
//GstSample *out_lastFrameSample;
//GstCaps *out_caps;
//GstBuffer *snapshotBuffer;
g_object_get(G_OBJECT(sink2), "last-sample", &lastFrameSample, NULL);
//lastFrameSample = gst_base_sink_get_last_sample(sink2);
out_caps = gst_caps_from_string ("image/png");
out_lastFrameSample = gst_video_convert_sample(lastFrameSample, out_caps,
GST_CLOCK_TIME_NONE, NULL); //Could not convert video frame: Internal data
stream error.
GST_DEBUG("out_lastFrameSample null: %i", (out_lastFrameSample == NULL));
//will be null
I was wondering if anyone can tell me what I’m doing wrong here, or if you
can think of a better way of grabbing a frame from a live h264 stream and
encode it to an image? Btw I’m doing this to generate a thumbnail, if you
know a better way of generating a thumbnail, I’m all ears.
Here's the pipeline diagram <https://imgur.com/a/y9N6N>
Thanks!
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list