Variable framerate/fps input video encoding questions

Nicolas Dufresne nicolas at
Thu Jul 18 16:00:18 UTC 2019

Le jeudi 18 juillet 2019 à 08:19 -0500, jles a écrit :
> Nicolas Dufresne-5 wrote
> > That can only be a miss-calculation of timestamp on your end. Using
> > appsrc requires good care on crafting correct timestamps.
> Agree this could it be the key of everything but I'm confuse with this, what
> I've done is:
> I do the calculation getting the appsrc clock (gst_element_get_clock) and
> base time (gst_element_get_base_time) after I get the time of the computed
> clock (gst_clock_get_time)  and then I calculate the difference:
> 		clock = gst_element_get_clock (GST_ELEMENT_CAST (appsrc));
> 		if (clock) {
> 		 base_time =
> 		 gst_element_get_base_time (GST_ELEMENT_CAST (appsrc));
> 		 now = gst_clock_get_time (clock);
> 		 if (now > base_time)
> 			 now -= base_time;
> 		 else
> 			 now = 0;
> 		 gst_object_unref (clock);
> 		 GST_BUFFER_PTS (buffer) = now;
> 		 GST_BUFFER_DTS (buffer) = now;
> 		}
> I compared with the actual camera framerate (fps given by the camera) and
> matches so I assume that the calculation is correct...
> I'm a bit lost here, I looked around and I couldn't find any good
> tutorial/examples on how to calculate properly timestamps with appsrc, 
> what would it be the best way/idea to compute properly timestamps?
> On the other hand I tried  to change the encoder target bit rate and this
> also affects to the resulting playback could it be instead a
> timestamp issue a bandwidth one?

Any jitter in your application will cause jitter in your timestamp with
this method. Though, I don't see any specific errors right now. This is
similar to the what the do-timestamp property on appsrc would do. This
follow the formulat:

  (now - base_time)

Which is the running time, which match what appsrc will have by
default. Ideally the timestamp would come from your camera and would be
translated from one clock to another. This is what we try and do with
v4l2src as an example (but it still a bit jittery I was told).
> Thanks.
> --
> Sent from:
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gstreamer-devel mailing list