Why did H.264, MPEG-4 HE AAC stop working on iphoneXS/Max?

假装没事ソ 提交于 2019-12-22 07:01:12

问题


Issue regarding NEW hardware

I have been investigating like crazy, and haven't found any hints to why my H.264 encoded videos have stopped working on these new devices.

Context: Direct from the ios device, the original is sent to s3, aws elastic transcoder then encodes the original into a more compressed H.264 preset. As of yesterday, a coworker was reporting all videos being "black", now since deliveries on these devices are being fulfilled, i've gotten confirmation. Cannot reproduce this issue on simulator. The encoded videos that are not playing, i've listed the exif data below.

Is there is anyone out there with a domain expertise in codecs, can you weigh in why a new device would fail to decode this H.264 video when devices since iphoneX and below have no problem?

➜  Downloads exiftool 30B3485D-24A3-4B6D-8B27-15B7C11FB864.mp4
ExifTool Version Number         : 11.10
File Name                       : 30B3485D-24A3-4B6D-8B27-15B7C11FB864.mp4
Directory                       : .
File Size                       : 202 kB
File Modification Date/Time     : 2018:09:24 20:35:47-07:00
File Access Date/Time           : 2018:09:24 20:36:02-07:00
File Inode Change Date/Time     : 2018:09:24 20:35:53-07:00
File Permissions                : rw-r--r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4  Base Media v1 [IS0 14496-12:2003]
Minor Version                   : 0.2.0
Compatible Brands               : isom, iso2, avc1, mp41
Movie Header Version            : 0
Create Date                     : 0000:00:00 00:00:00
Modify Date                     : 0000:00:00 00:00:00
Time Scale                      : 1000
Duration                        : 4.12 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 0000:00:00 00:00:00
Track Modify Date               : 0000:00:00 00:00:00
Track ID                        : 1
Track Duration                  : 4.12 s
Track Layer                     : 0
Track Volume                    : 100.00%
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Image Width                     : 320
Image Height                    : 568
Media Header Version            : 0
Media Create Date               : 0000:00:00 00:00:00
Media Modify Date               : 0000:00:00 00:00:00
Media Time Scale                : 15360
Media Duration                  : 4.00 s
Media Language Code             : und
Handler Description             : VideoHandler
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 320
Source Image Height             : 568
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Pixel Aspect Ratio              : 1:1
Video Frame Rate                : 30
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Encoder                         : Lavf57.71.100
Movie Data Size                 : 202178
Movie Data Offset               : 4545
Avg Bitrate                     : 393 kbps
Image Size                      : 320x568
Megapixels                      : 0.182
Rotation                        : 0

回答1:


This bug resolved itself for me in iOS13 beta release. Apple got back to me and informed me that the H264 header said that my video was version 4.0 but the first H264 frame says that it's 3.1, and iOS12 will not allow that.

I was able to fix this in code by specifying my header version as 3.1




回答2:


I had a similar problem to this with black video on iPhone XS Max, and it turns out that I was setting the keys kCVPixelBufferCGImageCompatibilityKey and kCVPixelBufferCGBitmapContextCompatibilityKey to YES in the sourcePixelBufferAttributes dictionary when creating the AVAssetWriterInputPixelBufferAdaptor. Commenting out those two keys from the dictionary seems to have fixed the problem.



来源:https://stackoverflow.com/questions/52490358/why-did-h-264-mpeg-4-he-aac-stop-working-on-iphonexs-max

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!