Opened 12 years ago
Last modified 12 years ago
#2481 new enhancement
libavformat doesn't update file duration when file size changes during playback
Reported by: | gjdfgh | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | unspecified | Keywords: | duration |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I would expect that libavformat updates AVFormatContext.duration when the size of the opened file changes, e.g. when playing partial files that are downloading.
This should work for all file formats or cases where the file duration is estimated from the size.
I tested with getting the first 10 MB of an avi file, starting a player using libavformat (mplayer based), then appending the next 30 MB to that file while the player was running. The AVFormatContext.duration field didn't change, and always contained the initial estimate.
Unfortunately this can't be reproduced with ffplay, it doesn't show the duration in its status line. Likewise, the ffmpeg program doesn't seem to show it anywhere.
Change History (5)
comment:1 by , 12 years ago
Keywords: | duration added |
---|
comment:3 by , 12 years ago
This is not so easy to fix, as getting the filesize can be expensive (for example with anything remote like ftp/http or even a remotely mounted fs) so one cannot just check the new filesize unconditionally per packet
comment:4 by , 12 years ago
You could do it every few packets (or a similar heuristic to reduce load), or you could add a new API function that requests duration recalculation.
comment:5 by , 12 years ago
Actually, looking at the sources for http and ftp, maybe you can assume getting the size is a fast operation. In these two protocols, they return a value stored in a variable without doing any network operations.
Is this reproducible with mplayer -demuxer lavf ?