I've confirmed the bug in getID3.
There's two ways of determining the duration of a FLV file:
a) look at the metadata chunk near the beginning of the file (usually the first chunk, but not always, but almost always within the first 10 chunks). This chunk gives basic information about the file (duration, bitrate, resolution, etc) and is by far the preferred method to extract that info, since it involves reading very little of the file to get all the needed info. If the metachunk isn't found, getID3 has to fall back to the second duration calculation method:
b) step through every chunk of audio and video data in the file. Each chunk has a timestamp associated with it, so look for the largest timestamp and that's your file duration (give or take the length of one frame, or roughly 0.03s in this case).
In the case of your sample file, the meta chunk existed, but the duration field was zero (most commonly this would happen on live encodes, when the encoder doesn't know file duration before the encoding starts, and can't go back to rewrite the header later). getID3 now checks that the meta-chunk exists and it non-zero, and if it doesn't find a usable duration in the meta-chunk is now allowed to examine up to 100,000 frames (configurable) rather than the previous limit of 20 (which was plenty to find the meta-chunk, but not to scan the whole file).
The patched version of module.audio-video.flv.php is attached, and will be included in v1.9.2
- (22.36KiB)Downloaded 1086 times