Hello,
I agree with you it's a pretty wild guess.
The problem I was faced with is that when I need to compute the total file duration, I need to take into account the last tag's duration.
However, back then (it's quite old code), I only met FLV files that ended with an audio tag, so I defaulted to using the audio tag as reference, which is pretty lame in retrospect :)
I thought it would not matter that much, because the difference is not that big, and popular video players are not always consistent with their handling of PTS. However you are right, it DOES make a difference and the best result should be achieved.
I'm gonna modify this to actually use the correct tag type. Could you please provide me with a sample file and the expected duration ? I've created an issue there:
https://github.com/noirotm/flvmeta/issues/5 please use this url to handle this issue together if possible.
Thanks !
-
Regards,
Marc
On Tuesday, April 16, 2013 11:25:44 AM UTC+2,
alban....@gmail.com wrote:
Hi,
I am working on a project that requires in video editing that requires a pass of an flv metadata updater on the produced files, and using flvmeta (as well as flvmdi), we end up with messed up frame rates and durations. Not by far, but enough not to be able to seek to the last frame. Which is a big issue in editing :-)
So I've been inside the code, and found that info.c, line 569, was the place of my problem:
if (info->have_audio) {
duration = (info->last_timestamp - (opts->reset_timestamps ? 0 : info->first_timestamp) + info->audio_frame_duration) / 1000.0;
}
else {
duration = (info->last_timestamp - (opts->reset_timestamps ? 0 : info->first_timestamp) + info->video_frame_duration) / 1000.0;
}
duration is either 59.986000=(59960-0+26)/1000 if I have audio, and 60=(59960-0+40)/1000 else, the latter being the right answer.
So the fix is easy for me (replace info->have_audio by !info->have_video), but as I have absolutely no experience with the FLV format, I am wondering what I will break :-) More seriously, what is the reason that makes flvmeta rely on the audio track rather than on the video track? Is there a reason not to choose the shortest or longest of all the tracks no matter their content for example?
Best regards