VideoToolbox can't decode MFT encoded H264 properly
Asked Answered
S

2

0

Did anyone experience an issue where VideoToolbox can't decode Media Foundation Transform (MFT) encoded H264 properly? The decoded frame has green block distortion more than half of the frame. I tried Livy Stork's example for decoding MFT encoded H264, which is transmitted over network from PC video endpoint running on Windows 7 desktop. I'm using Xcode 6.3 and running it on iOS 8 devices.

Clue: Same algorithm works fine when MFT encoded H264 comes from PC video endpoint running on Windows 8 or 8.1 desktop/tablet. According to MSDN, most codec properties aren't supported in Windows 7, but I can't figure it out which property makes the difference...

Supersonic answered 5/6, 2015 at 22:33 Comment(0)
F
1

But if you replace all the start code of all the NALUs, it should work. I have successfully solved a problem that using Video Toolbox to decode a data array with multiple I slices or multiple p slice when they start with 4 bytes start code then following 8 slice with 3 bytes start code. Just replace every start code with slice length respectively. Note that slice length doesn't include start code length, you should ignore them.

Fungistat answered 25/8, 2016 at 17:37 Comment(0)
S
0

It turned out MFT H264 encoder on Windows 7 returns a frame with multiple NALs. VideoToolbox decoder requires the NAL start code (0x00 00 00 01) to be replaced with the NAL size; when it finds the second NAL start code in the frame, it stops decoding. Again MFT H264 encoder on Windows 8 or higher doesn't do this.

Supersonic answered 9/6, 2015 at 14:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.