This repository has been archived by the owner. It is now read-only.

H.264 and the discardable flag #2047

Closed
mkver opened this Issue Jul 17, 2017 · 2 comments

Comments

2 participants
@mkver

mkver commented Jul 17, 2017

Hello,

MKVToolNix currently sets the discardable flag of SimpleBlocks in a completely wrong way. It changes it even when its input is a Matroska file with perfectly true flags (created by x264.exe). There is a simple way to check if a NAL unit is discardable: If nal_ref_idc is 0. So if a SimpleBlock contains only NAL units with nal_ref_idc equal to zero, it can get the discardable flag; otherwise not. nal_ref_idc is contained in the second and third bit of every NAL unit. (Although it uses two bits, the standard only differentiates between it being zero and it being different from zero. In practice, x264 and maybe other encoders use it to convey a sense of importance; i.e. x264 reserves 3 for IDR frames (and maybe SPS/PPS).)
There's a problem with the above recipe: It requires you to parse the bitstream and I don't think you want to do that with framed input. So my suggestion is: Set the right flags for unframed input and in case of framed input you should set the flag if and only if the it had been set in the input file.

Grüße
Andi

PS: This has been discussed before in #179. The doom9 post mentioned is here.

@mbunkus

This comment has been minimized.

Show comment
Hide comment
@mbunkus

mbunkus Jul 17, 2017

Owner

Thanks, I'll look into it, albeit with lower priority.

Owner

mbunkus commented Jul 17, 2017

Thanks, I'll look into it, albeit with lower priority.

@mbunkus mbunkus added this to the later milestone Aug 29, 2017

mbunkus added a commit that referenced this issue Aug 30, 2017

@mbunkus mbunkus closed this in 06bebb1 Aug 30, 2017

@mkver

This comment has been minimized.

Show comment
Hide comment
@mkver

mkver Aug 31, 2017

I just checked the latest pre-build and this seems to be working fine. Thanks!

mkver commented Aug 31, 2017

I just checked the latest pre-build and this seems to be working fine. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.