Appsrc example - variable framerate and setting duration to the buffers

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

I'm trying to understand the example in Gstreamer tutorial with appsrc:

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

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
                     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

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list