ios - AVAssetWriterInput,无法选择视频分辨率吗?

标签 ios video avfoundation

无论选择哪种AVVideoWidthKeyAVVideoHeightKeyAVVideoCleanApertureWidthKeyAVVideoCleanApertureHeightKey,我的视频分辨率看起来都是320x240或480x360。

我正在尝试将视频保存为480p,我的所有缓冲区均为640x480,我的 session 位于AVCaptureSessionPreset640x480,所有内容均为640x480,但我的输出视频仍然按比例缩小。

我使用的是AVAssetWriterInputPixelBufferAdaptor,传递给它的CMSampleBufferRef是640x480。

我到处都在查看Stack Overflow,但尚未发现此问题。 :/

最佳答案

我一直使用此设置,并且可以正常工作。这是一个代码示例。

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];

关于ios - AVAssetWriterInput,无法选择视频分辨率吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8394935/

相关文章:

ios - Swift: self.init (coder : aDecoder) 使用 EXC_BAD_ACCESS 导致应用程序崩溃

video - FFMPEG 视频转换为 MP4 可以在除 iOS Safari/Chrome 之外的任何地方使用

HTML5 视频 - 暂停加载/部分加载

android - HTML5 视频 : How to enable *non-muted* autoplay in Chrome for Android

ios - AVCapturePhotoOutput jpegPhotoDataRepresentation 访问预览照片

xcode - AVAudioPlayer 在播放前释放?

iphone - 什么都没用!证书和供应把我的生活变成了人间 hell

ios - 我可以在没有 64 位兼容性的情况下更新我的 64 位兼容 iOS 应用程序吗?

iOS 自动布局 : Issues with 2 variable sized boxes and 1 fixed sized box

ios - 在说话之前快速清除 AVSpeechSynthesizer