another simple question about duration

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

another simple question about duration

Andres Gonzalez

I have a simple pipeline:   filesrc  ->  decodebin  .....  -> appsrc

which works just fine but I am having problems getting an accurate duration query. I am using:

    gst_element_query_duration(GST_ELEMENT(pGstPipeline), GST_FORMAT_TIME, &lDuration));

which always gives me a duration of 99:99:99.999999999.

The files I am using are the big buck bunny files which appear to be correctly formatted containers. When I use gst-discoverer-1.0 on these files its reports the correct duration of 0:09:56.461666666. So it appears that container files have the duration. I have tried to call the query on various elements in the pipeline but still I get the incorrect duration. In a similar way, I am querying the position during playback using:

    gst_element_query_position(GST_ELEMENT(pGstPipeline), GST_FORMAT_TIME, &lPosition));

and it works correctly.

So what is the secret to getting the duration of a media file?