• Sasi Inguva's avatar
    lavf/mov.c: offset index timestamps by the minimum pts to make first pts zero · 93db5e3f
    Sasi Inguva authored
    If the videos starts with B frame, then the minimum composition time
    as computed by stts + ctts will be non-zero. Hence we need to shift
    the DTS, so that the first pts is zero. This was the intention of that
    code-block. However it was subtracting by the wrong amount.
    
    For example, for one of the videos in the bug nonFormatted.mp4 we have
    
    stts:
    sample_count  duration
    960           1001
    
    ctts:
    sample_count  duration
    1             3003
    2             0
    1             3003
    ....
    
    The resulting composition times are :  3003, 1001, 2002, 6006, ...
    
    The minimum composition time or PTS is 1001, which should be used to
    offset DTS. However the code block was wrongly using ctts[0] which is
    3003. Hence the PTS was negative. This change computes the minimum pts
    encountered while fixing the index, and then subtracts it from all the
    timestamps after the edit list fixes are applied.
    
    Samples files available from:
    
    https://bugs.chromium.org/p/chromium/issues/detail?id=721451
    https://bugs.chromium.org/p/chromium/issues/detail?id=723537
    
    fate-suite/h264/twofields_packet.mp4 is a similar file starting with 2
    B frames. Before this change the PTS of first two B-frames was -6006
    and -3003, and I am guessing one of them got dropped when being decoded
    and remuxed  to the framecrc before, and now it is not being dropped.
    Signed-off-by: 's avatarSasi Inguva <isasi@google.com>
    93db5e3f
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_opencl.c Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_cuvid.c Loading commit data...
ffmpeg_dxva2.c Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffmpeg_qsv.c Loading commit data...
ffmpeg_vaapi.c Loading commit data...
ffmpeg_vdpau.c Loading commit data...
ffmpeg_videotoolbox.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
ffserver_config.c Loading commit data...
ffserver_config.h Loading commit data...