Appsrc example - variable framerate and setting duration to the buffers

Nicolas Dufresne nicolas at ndufresne.ca
Sat Mar 16 20:37:15 UTC 2019


Le samedi 16 mars 2019 à 20:02 +0000, Wudo Balmus a écrit :
> 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?

I believe this is simply to show that you don't have to use fixed framerate and can use variable framerate. GStreamer synchronisation uses the timestamp, not the framerate for videos.
> Best regards,
> Wudo
> 
> 
> _______________________________________________gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190316/c679e18b/attachment.html>


More information about the gstreamer-devel mailing list