加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

AVVideoProfileLevelH264High41破解iPhone 4

发布时间:2020-12-14 19:50:19 所属栏目:百科 来源:网络整理
导读:我正在使用AVAssetWriter压缩视频,该代码适用于iOS7中的iPhone 5和4.我试图使用AVVideoProfileLevelH264High41的AVVideoProfileLevelKey来获得比基线或主配置文件更好的压缩.该代码适用于iOS7与iPhone 5,但在iPhone 4上发生以下错误.下面的错误中列出的大多
我正在使用AVAssetWriter压缩视频,该代码适用于iOS7中的iPhone 5和4.我试图使用AVVideoProfileLevelH264High41的AVVideoProfileLevelKey来获得比基线或主配置文件更好的压缩.该代码适用于iOS7与iPhone 5,但在iPhone 4上发生以下错误.下面的错误中列出的大多数这些配置文件另外不起作用.

有人知道如果高分辨率的压缩在iPhone 4上不起作用,苹果文档只说明它需要iOS6或更高版本.

> 2013-12-10 18:26:37.637 VideoCompression[677:3707] *** Terminating app

> due to uncaught exception 'NSInvalidArgumentException',reason: '***

> `-[AVAssetWriterInput initWithMediaType:outputSettings:sourceFormatHint:]` For compression
> property ProfileLevel,video codec type avc1 only allows the following

> values: H264_Baseline_1_3,H264_Baseline_3_0,H264_Baseline_3_1,> H264_Baseline_4_1,H264_Main_3_0,H264_Main_3_1,H264_Main_3_2,> H264_Main_4_0,H264_Main_4_1,H264_Main_5_0,H264_High_5_0,> H264_Baseline_AutoLevel,H264_Main_AutoLevel,H264_High_AutoLevel'

> *** First throw call stack: (0x2fd76f4b 0x3a1066af 0x2ec5d833 0x2ec5d70b 0x2ec5d67d
 0xbd001 0xbba59 0x3a5e9d1b 0x3a5ea293 0x3a5ea6f7

> 0x3a5fc8f9 0x3a5fcb79 0x3a72bdbf 0x3a72bc84) libc++abi.dylib:

> terminating with uncaught exception of type NSException
NSDictionary *codecSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                           [NSNumber numberWithInteger:[bitrateTF.text intValue]],AVVideoAverageBitRateKey,[NSNumber numberWithInt:[maxkeyframeintervalTF.text intValue]],AVVideoMaxKeyFrameIntervalKey,**AVVideoProfileLevelH264High41,AVVideoProfileLevelKey,**
                                           videoCleanApertureSettings,AVVideoCleanApertureKey,videoAspectRatioSettings,AVVideoPixelAspectRatioKey,nil];

NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                       AVVideoCodecH264,AVVideoCodecKey,AVVideoScalingModeResizeAspectFill,AVVideoScalingModeKey,codecSettings,AVVideoCompressionPropertiesKey,[NSNumber numberWithInt:[widthTF.text intValue]],AVVideoWidthKey,[NSNumber numberWithInt:[heightTF.text intValue]],AVVideoHeightKey,//AVVideoScalingModeFit,nil];
self.assetWriterVideoInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
self.assetWriterVideoInput.transform = self.transformAssetWriter;
[self.assetWriter addInput:self.assetWriterVideoInput];

解决方法

您无法使用iPhone4在ProfileLevelH264High41中进行编码,仅支持iPhone4S

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读