I've spent hours searching the documentation and forums for a simple variable and it's driving me crazy. Can anyone tell me what the variable is that gives the total duration of a video, so that I can draw a progress bar on a video played by FFplay?

My filter is:


but duration is not recognised. I've tried t, time, total_time, dur, len, length, total_length, s, secs, stream_length, all to no avail. (A box does get drawn if I just put w=50, for example, so the rest is correct, but I need it to change over time.)

I'm amazed I haven't yet found a comprehensive list of these variables.

If anyone can help, I'd be super grateful. Thanks.

  • Total duration of video is a pretty complicated thing before the video itself is finished.;-) So there is no such a variable. An individual filter may obtain (from the previous) info such as the presentation time stamp or width, but not the total time.
    – MarianD
    Mar 10 at 14:57
  • That's true during streaming and encoding, but during ffplay playback the file is already complete and not being altered. I guess I'll need a whole routine just to probe the duration before playback. Pity, a single command line would've been so elegant.
    – Spiritman
    Mar 10 at 16:28
  • FFplay also accept filters. - Anyway, there is not such a variable (for total duration), it is not such a simple thing even for a complete video. Media players only estimate the total time – in most cases with acceptable tolerance (say within 1-second interval). You have to deal with this fact, as did I and many other people.;-)
    – MarianD
    Mar 10 at 16:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.