[FFmpeg-trac] #7303(undetermined:open): h264_nvenc / b_ref_mode middle creates invalid video due to Invalid DTS.

FFmpeg trac at avcodec.org
Tue Oct 29 02:53:10 EET 2019


#7303: h264_nvenc / b_ref_mode middle creates invalid video due to Invalid DTS.
-------------------------------------+-------------------------------------
             Reporter:               |                    Owner:
  smallishzulu                       |
                 Type:  defect       |                   Status:  open
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:  nvenc        |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Changes (by Balling):

 * status:  new => open


Comment:

 #7746, #7302, #7561 merged in this issue. There are were actually a few
 open issues https://trac.ffmpeg.org/search?q=b_ref_mode (#7301 is about
 "-b_ref_mode each" not currently implemented for h264_nvenc in NVIDIA's
 Video SDK https://github.com/NVIDIA/video-sdk-
 samples/blob/aa3544dcea2fe63122e4feb83bf805ea40e58dbe/Samples/NvCodec/NvEncoder/nvEncodeAPI.h#L614)

 So, the message is generated by this
 https://github.com/FFmpeg/FFmpeg/blob/6f2a3958cfac135c60b509a61a4fd39432d8f9a9/fftools/ffmpeg.c#L768
 implemented here
 https://github.com/FFmpeg/FFmpeg/commit/22844132069ebd2c0b2ac4e7b41c93c33890bfb9
 As we can see the DTS - PTS is 3600. But well this is not always the case.
 On my machine DTS - PTS is always 3754.

 {{{
 [mpegts @ 000001b30fe12f00] Invalid DTS: 7508 PTS: 3754 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 11261 PTS: 7508 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 26276 PTS: 22523 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 30030 PTS: 26276 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 45045 PTS: 41291 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 48799 PTS: 45045 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 63814 PTS: 60060 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 67568 PTS: 63814 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 82583 PTS: 78829 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 86336 PTS: 82583 in output stream
 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 101351 PTS: 97598 in output
 stream 0:0, replacing by guess
 [mpegts @ 000001b30fe12f00] Invalid DTS: 105105 PTS: 101351 in output
 stream 0:0, replacing by guess
 }}}
 And in issue #7561 it is always 1800. Also it is said there "nvenc ffmpeg
 code or nvenc library from nvidia should either not produce bad timestamps
 that make ffmpeg report them".
 In issue #7746 it is off by 1, so...


 In #7302 Nvidia tells us that "Further, using B-frames as reference
 requires a DPB size of at least 3 (2 slots for the reference frames on
 which the B-frame would depend and one slot for the B-frame itself), so in
 this specific case (-dpb_size 2), the DPB is not large enough for use with
 the B-frames as reference feature." BTW, -dpb_size was -refs before but
 was renamed in commit
 https://github.com/FFmpeg/FFmpeg/commit/e929b2f248a9c49761475e07d1a089e05912d1c6
 not so long ago.
 Also it now says "InitializeEncoder failed: invalid param (8): DPB size
 should be greater than or equal to 3 for B as reference." generated by
 https://github.com/FFmpeg/FFmpeg/blob/ab0ef1abdf53e257f7628f2d264adc80038f3bcb/libavcodec/nvenc.c#L1262

 This issue is the worst because it (if valid) produce broken output. Which
 is unacceptable. But  everybody else says that everything is working for
 them. And it is working for me.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7303#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list