How to force keyframes using Python GST bindings
Gary Metalle
Gary.Metalle at rvl.co.uk
Fri Nov 6 09:02:33 UTC 2020
Hi
I'm not sure about the Python bindings but it's very easy to force the encoder to knock out a keyframe when you want:
GstPad *encoder_src_pad = gst_element_get_static_pad(st->streamer.encoder, "src");
if (encoder_src_pad) {
gst_pad_send_event(encoder_src_pad, gst_event_new_custom(GST_EVENT_CUSTOM_UPSTREAM,
gst_structure_new("GstForceKeyUnit", "all-headers",G_TYPE_BOOLEAN, TRUE, NULL)));
gst_object_unref(encoder_src_pad);
}
Note in my example the 'st->streamer.encoder' is the pointer to the GstElement that is the h264 encoder.
Gary.
________________________________________
From: gstreamer-devel <gstreamer-devel-bounces at lists.freedesktop.org> on behalf of Moiz <moiz at playpixel.app>
Sent: 06 November 2020 01:25
To: gstreamer-devel at lists.freedesktop.org
Subject: How to force keyframes using Python GST bindings
Hello, I am building my gstreamer pipeline to encode h264, and send rtp
packets over udp.
Ideally I can request a keyframe when packets are lost, I am not exactly
sure how I would do this.
I am thinking I can setup a small http server to listen for packets lost,
and am wondering if there is any gst function I can run to force a keyframe.
I have come across this article
https://gstreamer.freedesktop.org/documentation/additional/design/keyframe-force.html?gi-language=c
However, I am not sure as this forcing keyframe action can be implemented
using the python gst bindings.
Is this possible, if so how can I go about it?
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list