[FFmpeg-devel] [PATCH 0/1] avformat/mpegts: fix first NAL start code splited in two different packets

Nicolas Gaullier nicolas.gaullier at cji.paris
Fri Feb 2 17:23:37 EET 2024


This issue happens in the following case:
- unaligned PES and NAL encoding
- the first NAL of the access unit begins at the very end of a ts packet, sometimes only the 0x00 of the trailing byte
(unfortunately, this is still conformant to the standards!)
- the video frame is so small (ex: typically still picture) it fits in a ts packet and a new PES is immediately started

Two sample files can be found here:
a) https://0x0.st/HDwD.ts
b) https://0x0.st/HDwd.ts

For sample a, the first NAL (AUD) is splited this way:
0x00 / 0x00 0x00 0x01 0x09
And for sample b:
0x00 0x00 0x00 / 0x01 0x09

ffmpeg -i input.ts -f null /dev/null
=> Application provided invalid, non monotonically increasing dts...


Nicolas Gaullier (1):
  avformat/mpegts: fix first NAL start code splited in two different
    packets

 libavformat/mpegts.c | 41 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

-- 
2.30.2



More information about the ffmpeg-devel mailing list