Variable framerate/fps input video encoding questions

jles jlesquer at gmail.com
Thu Jul 18 13:19:58 UTC 2019


Hi Nicolas,

Thanks for your reply.


Nicolas Dufresne-5 wrote
> What is not possible which this, is for GStreamer to evaluate the
> latency requires if you would like to do live streaming out of it. Best
> is to pretend you are doing 10fps, and the latency calculation will be
> made from that, then having early frames should not be a problem.

Do you mean that for a live source like this case it would be convenient to
set the appsrc caps framerate to the lowest expected fps?

If I'm doing this the resulting encoded and container file after mpegtsmux
will have that let's say 10fps low framerate timestamps....so what would
happen if the framerate is increased during that time let's say to 400fps
would all frames be discarded? 

 

Nicolas Dufresne-5 wrote
> Note that videorate will likely drop or add frames to you stream, is
> this really what you are looking for ?

You are right it might be no ideal here, I used it initially because I tried
to set a variable framerate in the appsrc caps and it was the only way to
don't get a "no enough resources available" error from the encoder. But now
I'm setting a appsrc caps constant framerate  I'll  delete it from the
pipeline...



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 speed...so could it be instead a
timestamp issue a bandwidth one?

Thanks.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list