Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Conversation

@jcdr428
Copy link
Collaborator

@jcdr428 jcdr428 commented Dec 29, 2019

Currently, buffer overflow is not avoided in all cases, i.e. nextNal can have end buffer value instead of start of next nal value.
This results in the AUD NAL not being always at the begining of a PES packet.
This patch solves this by ensuring that when nextNal == bufEnd, data is always added to buffer.

Currently, buffer overflow is not avoided in all cases, i.e. nextNal can have end buffer value instead of start of next nal value.
This results in the AUD NAL not being always at the begining of a PES packet.
This patch solves this by ensuring that when nextNal == bufEnd, data is always added to buffer.
@justdan96 justdan96 added the bug Something isn't working label Dec 29, 2019
@justdan96
Copy link
Owner

Has this been tested with very large files? I think a good test would be to get "Samsung 7 Wonders Of The World 4K Demo" in HEVC format and check the mediainfo for the before and after files.

@jcdr428
Copy link
Collaborator Author

jcdr428 commented Dec 29, 2019

@justdan96 thanks for pointing me to "Samsung 7 Wonders Of The World 4K Demo.ts" : actually many frame VCL Nals are followed by FD_NUT (filler data) Nals, which only use is to keep a constant bitrate. The presence of these Nals is not covered by tsMuxer.

So yes, I will have to complete the patch to take into account the filler data Nals. Please put the patch as "wip".

@justdan96 justdan96 added the wip Work in Progress label Dec 29, 2019
@justdan96
Copy link
Owner

No problem, we really need to come up with a proper test suite at some point, to make sure we are covering all example cases.

Currently tsMuxer does not detect suffix nals (non VCL nals placed after the VCL nals in the nal unit).
Therefore these nals are placed first in the TS PES, before the AUD or next frame nal.

This patch fixes the above.
Currently tsMuxer does not detect suffix nals (non VCL nals placed after the VCL nals in the nal unit).
Therefore these nals are placed first in the TS PES, before the AUD or next frame nal.

This patch fixes the above.
Currently tsMuxer does not detect suffix nals (non VCL nals placed after the VCL nals in the nal unit).
Therefore these nals are placed first in the TS PES, before the AUD or next frame nal.

This patch fixes the above.
@jcdr428
Copy link
Collaborator Author

jcdr428 commented Dec 31, 2019

@justdan96 I have tested this fix with several m2ts (Blu-rays and others), it is working well and ready to be merged.

This solves the BD-ROM Part3 Verifier errors HEVC0112 and HEVC0115:

----------------------------------------------
Error ID      : HEVC0112
Target File   : 00000.m2ts <HEVC PID=0x1011>
Target Field  : <PES packet of the HDMV HEVC video stream>
Section No    : 9.19.7
Error Message : The first byte of a PES packet payload is not the first byte of video access unit.
            
            File offset of PES packet = 4057544
            File offset of PES packet payload = 4057558
            File offset of the video access unit =4223220.
Explanation   : The first byte of a PES packet payload shall be the first byte of video access unit. 
            One PES packet shall contain only one access unit.
----------------------------------------------
Error ID      : HEVC0115
Target File   : 00000.m2ts <HEVC PID=0x1011>
Target Field  : <PES packet of the HDMV HEVC video stream>
Section No    : 9.19.7
Error Message : The first byte of the PES packet which contains an access unit that starts with a 
            SPS NAL unit is not multiplexed in the same TS packet with the first byte of the Access 
            unit delimiter NAL unit
            
            File offset of the Access Unit delimiter = 4223224.
            File offset of the PES packet = 4057544.
Explanation   : If a PES packet contains an access unit that starts with a Sequence parameter set 
            NAL unit (GOP start), both the first byte of the PES packet and the first byte of 
            the Access unit delimiter NAL unit shall be multiplexed in the same transport packet.
----------------------------------------------

Note that when muxing hevc files to Blu-ray which do not have any AUD nal, indeed there won't be any AUD at the beginning of the GOP. Adding AUD nals when not present should be addressed later.

@justdan96 justdan96 merged commit c3c7f6c into justdan96:master Jan 5, 2020
@jcdr428 jcdr428 deleted the patch-1 branch January 6, 2020 20:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working wip Work in Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants