Changeset 670ff6c7 in ffmpeg

Timestamp:
Aug 2, 2024, 3:57:19 PM (4 months ago)
Author:
Timo Rothenpieler <timo@rothenpieler.org>
Branches:
master
Children:
afd45c7
Parents:
bcea693f
git-author:
Zhao Zhili <zhilizhao@tencent.com> (07/17/24 09:47:13)
git-committer:
Timo Rothenpieler <timo@rothenpieler.org> (08/02/24 15:57:19)
Message:

avcodec/nvenc: rework on DTS generation

Before the patch, the method to generate DTS only works with
timebase equal to 1/fps. With timebase like 1/1000

./ffmpeg -i foo.mp4 -an -c:v h264_nvenc -enc_time_base 1/1000 bar.mp4

pts 0 dts -3
pts 160 dts 37
pts 80 dts 77
pts 40 dts 117 <-- invalid
pts 120 dts 157
pts 320 dts 197
pts 240 dts 237
pts 200 dts 277 <-- invalid
pts 280 dts 317 <-- invalid

The generated DTS can be larger than PTS, since it only reorder the
input PTS and minus the number of frame delay, which doesn't take
timebase into account. It should minus the "time" of frame delay.

9a245bd trying to fix the issue, but the implementation is incomplete,
which only use time_base.num. Then it got reverted by ac7c265b33b.

After this patch:

pts 0 dts -120
pts 160 dts -80
pts 80 dts -40
pts 40 dts 0
pts 120 dts 40
pts 320 dts 80
pts 240 dts 120
pts 200 dts 160
pts 280 dts 200

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>

(No files)

Note: See TracChangeset for help on using the changeset viewer.