-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hey! Actually I cannot see what Mediabunny is doing wrong here. Mediabunny itself parses the file's duration as 30.36 seconds, which lines up with the end timestamp of the last packet. Even in the container metadata that value is stored. So the question is, why do FFmpeg and Chromium think the video is 43 seconds long? Could be that Chromium uses FFmpeg to determine the duration and that's why they agree. The thing that sticks out to me is which is odd, since the duration is supposed to be 0.128000. FFmpeg is probably summing up all packet durations and adding the start offset to reach the final duration of 43 seconds. That first packet duration is probably a side-effect of how the start offset is being modeled by Mediabunny, since MP4 doesn't play too well with tracks starting at non-zero timestamps. But to be honest, this almost seems like incorrect behavior from FFmpeg (an FFmpeg bug). If you need a quick fix, since you're working with media that uses non-zero timestamp offsets, try using fragmented MP4 as muxing output instead - it handles that quite a bit better. |
Beta Was this translation helpful? Give feedback.
-
|
Update: I fixed this behavior in 782d3e1. FFmpeg now reports the correct duration for non-zero start timestamp MP4s. |
Beta Was this translation helpful? Give feedback.

Hey! Actually I cannot see what Mediabunny is doing wrong here. Mediabunny itself parses the file's duration as 30.36 seconds, which lines up with the end timestamp of the last packet. Even in the container metadata that value is stored. So the question is, why do FFmpeg and Chromium think the video is 43 seconds long? Could be that Chromium uses FFmpeg to determine the duration and that's why they agree.
The thing that sticks out to me is
which is odd, since the duration is supposed to be 0.128000. FFmpeg is probably summing up all packet durations and adding the start offset to reach the final duration of 43 seconds.
That first packet duration is probably a side-eff…