View Single Post
Old 5th March 2019, 17:28   #14786  |  Link
mkver
Registered User
 
Join Date: May 2016
Posts: 197
Quote:
Originally Posted by sneaker_ger View Post
Progressive 1080p25 encoded as interlaced.
That's not the whole story. It's MBAFF with pic_struct SEIs declaring every coded frame to be progressive; furthermore, bottom_field_pic_order_in_frame_present_flag is set to zero (meaning that the top and bottom fields of the coded frames have the same pic order count and even in the absence of a pic_struct SEI the coded frames should be considered progressive*). But it also has ct_type equal to 1 which means that the original source material is interlaced; furthermore the specs contain the clause that "Two consecutive fields in output order shall have different values of clockTimestamp when the value of ct_type for either field is 1 (interlaced)." This means that this stream is simply out-of-spec!

The reason that this particular sample is treated as interlaced is that FFmpeg uses the ct-type to override the pic_struct (notice that ct_type isn't simply the value read from the bitstream). So changing the ct_type is one way of fixing this.

Notice that ffmpeg has a bug because it always flags MBAFF as interlaced in the absence of SEI (see here) regardless of the pic order count of the fields involved. This means that simply deleting the SEI would not change the behaviour of FFmpeg based players unless FFmpeg is fixed, too (and the player updated).

*: From the semantics of pic_struct:
"NOTE 6 – When pic_struct_present_flag is equal to 0, then in many cases default values may be inferred. In the absence of other indications of the intended display type of a picture, the decoder should infer the value of pic_struct as follows:
– If field_pic_flag is equal to 1, pic_struct should be inferred to be equal to (1 + bottom_field_flag).
– Otherwise, if TopFieldOrderCnt is equal to BottomFieldOrderCnt, pic_struct should be inferred to be equal to 0 [progressive frame].
– Otherwise, if TopFieldOrderCnt is less than BottomFieldOrderCnt, pic_struct should be inferred to be equal to 3 [TFF].
– Otherwise (field_pic_flag is equal to 0 and TopFieldOrderCnt is greater than BottomFieldOrderCnt), pic_struct should be
inferred to be equal to 4 [BFF]."
mkver is offline