首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AVAssetWriterInput,不能选择视频分辨率吗?

AVAssetWriterInput,不能选择视频分辨率吗?
EN

Stack Overflow用户
提问于 2011-12-06 11:17:05
回答 1查看 5.7K关注 0票数 1

不管我选择AVVideoWidthKeyAVVideoHeightKeyAVVideoCleanApertureWidthKey还是AVVideoCleanApertureHeightKey,我的视频分辨率都将是320x240或480x360。

我正在尝试以480p保存视频,我所有的缓冲区都是640x480,我的会话在AVCaptureSessionPreset640x480上,所有内容都是640x480,但我的输出视频仍然被缩小了。

我使用的是AVAssetWriterInputPixelBufferAdaptor和传入的CMSampleBufferRef,它的大小是640x480。

我已经找遍了堆栈溢出,但我还没有发现这个问题被报告。:/

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-15 10:47:43

我一直在使用这个设置,它是有效的。这是一个代码示例。

代码语言:javascript
复制
self.compressionProperties = [[[NSMutableDictionary alloc] initWithObjectsAndKeys:
                               [NSNumber numberWithInt:params.bps], AVVideoAverageBitRateKey,
                               [NSNumber numberWithInt:params.keyFrameInterval],AVVideoMaxKeyFrameIntervalKey,
                               //videoCleanApertureSettings, AVVideoCleanApertureKey,
                               params.videoProfileLevel, AVVideoProfileLevelKey,
                               nil ] autorelease];

self.videoSettings = [[[NSMutableDictionary alloc] initWithObjectsAndKeys:AVVideoCodecH264, AVVideoCodecKey,
                       [NSNumber numberWithInt:params.outWidth], AVVideoWidthKey,
                       [NSNumber numberWithInt:params.outHeight], AVVideoHeightKey, 
                       self.compressionProperties, AVVideoCompressionPropertiesKey,
                       nil] autorelease];

...

wobj.writerInput = [[[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:self.videoSettings] autorelease];
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8394935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档