gst_element_query_duration on http stream

Patrick Fischer patrick.fischer at vitec.com
Wed Nov 22 10:52:43 UTC 2023


Hello

I have a problem with determining the duration of a file which is accessed via http. I have a basic question.

My pipeline looks like this:

souphttpsrc -> queue -> typefind -> tsdemux -> queue -> h264parse -> capsfilter -> appsink

the video is a Mpeg-TS which I address in this way:
http://192.168.1.1/test.ts

If I now want to determine the length of the video I use:
gint64 duration = 0;
if (!gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration)) {
g_print("Could not query current duration.\n");
return 0;
}

I would expect the web server to load the first packets, determine the PTS or PCR and then try to sprint to the end of the file to determine the PTS or PCR there. The duration is then determined from the different. Of course this method would still have the problem with the overrun but apparently GStreamer uses a different method to determine the length.


On the one hand, however, I can see that the end of the file is never loaded and that the calculated duration fluctuates greatly. Every time I query the duration from the pipeline, I get different values. Fluctuate by a few seconds.
I have a file here that is supposedly about 25 minutes long. Only after I have seen the file for 10 minutes, the calculated duration jumps slowly to 30 minutes (which is the correct duration).

How can I get gstreamer to calculate a better duration?
Downloading completely is not an option.

Regards
Patrick

Patrick Fischer
Software Developer
o: 
+49 4307 8358 0
patrick.fischer at vitec.com
www.vitec.com


Legal Notice
 Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this e-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this e-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately. Neither VITEC S.A. (66 Avenue des Champs Elysées – 75008 Paris - France) nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. VITEC GmbH, Lise-Meitner-Str. 15, 24223 Schwentinental
 Geschäftsführer/Managing Director: Philippe Wetzel
 HRB Plön 1584 / Steuernummer: 2029706365 / VATnumber: DE134878603
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20231122/a676f09b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image680724.png
Type: image/png
Size: 30451 bytes
Desc: image680724.png
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20231122/a676f09b/attachment-0001.png>


More information about the gstreamer-devel mailing list