Appsrc example - variable framerate and setting duration to the buffers

Wudo Balmus wudo.balmus at gmail.com
Sat Mar 16 20:02:23 UTC 2019


Hello,
I'm trying to understand the example in Gstreamer tutorial with appsrc:
https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html

There is written a sentence:

"We configure a video stream with a variable framerate (0/1) and we set the
timestamps on the outgoing buffers in such a way that we play 2 frames per
second."

then caps with variable framerate are set to appsrc:

g_object_set (G_OBJECT (appsrc), "caps",
        gst_caps_new_simple ("video/x-raw",
                     "format", G_TYPE_STRING, "RGB16",
                     "width", G_TYPE_INT, 384,
                     "height", G_TYPE_INT, 288,
                     "framerate", GST_TYPE_FRACTION, 0, 1, <-- variable
framerate
                     NULL), NULL);

and then when we generate each buffer, the duration is set for each buffer
to 0.5s:

GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 2);

The question is, why do we set the framerate to be variable (0/1)?
Shouldn't we set it to constant 2 FPS instead as we generate 2 buffers each
second?

Best regards,
Wudo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190316/e2c6cc75/attachment.html>


More information about the gstreamer-devel mailing list