Hi, 
    Recently, I met a case of wrong audio duration when ffprobe a mp4 file use 
FFmpeg 4.0, but right in FFmpeg 4.1.3. 
    In moov, the audio duration was right, the format duration (in mvhd) was 
wrong. But the probe output showed that the audio duration was set to the wrong 
format duration.

    I root cause this case and found out two patches can fix the problem:
commit 28503c5aea5f5ecaab95e9d0c56064132e4796d3, This fix the problem of wrong 
duration caculation. 
[https://github.com/FFmpeg/FFmpeg/commit/28503c5aea5f5ecaab95e9d0c56064132e4796d3]
commit 12673bb25342c772e1bf5fd2adebd85f97dc616e, This fix the problem of audio 
stream start_time not set. 
[https://github.com/FFmpeg/FFmpeg/commit/12673bb25342c772e1bf5fd2adebd85f97dc616e]
    The first patch was resonable while the second patch puzzed me a lot. Why I 
need this one? Because if the stream start_time is not set, it will be filled 
in avformat_find_stream_info() -> estimate_timings() -> 
fill_all_stream_timings() [libavformat/utils.c], AND at the same time, this 
function will replace the stream duration with the Format Duration, so stream 
start_time must be set so that I can get the right audio duration. 
    
    I have two questions now:
Why should fill_all_stream_timings() update stream duration when stream 
start_time is not set? 
In mp4 demuxer, codes related to stream start_time setting only used by video 
stream before patch 12673bb25342c772e1bf5fd2adebd85f97dc616e. Now in 
mov_build_index() still as it is, should this be fixed too?
    


vacingf...@qq.com
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to