How to force keyframes using Python GST bindings

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to force keyframes using Python GST bindings

Moiz
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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to force keyframes using Python GST bindings

Gary Metalle
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 <[hidden email]> on behalf of Moiz <[hidden email]>
Sent: 06 November 2020 01:25
To: [hidden email]
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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel