相关疑难解决方法(0)

ASSETWriterInput用于在Iphone问题上从UIImages制作视频

我尝试了以下两种方法来附加UIImages pixelbuffer ASSETWriterInput.除了视频文件中没有数据外,一切看起来都不错.怎么了?

1适配器类

AVAssetWriterInputPixelBufferAdaptor * avAdaptor = [AVAssetWriterInputPixelBufferAdaptor assetWriterInputPixelBufferAdaptorWithAssetWriterInput:writerInput sourcePixelBufferAttributes:NULL];

[avAdaptor appendPixelBufferixelBuffer withPresentationTime:CMTimeMake(1, 10)];
Run Code Online (Sandbox Code Playgroud)

2制作

// Create sample buffer.
CMSampleBufferRef sampleBuffer = NULL;
result = CMSampleBufferCreateForImageBuffer(kCFAllocatorDef ault, pixelBuffer, true, NULL, NULL, videoInfo, &timing, &sampleBuffer);

// Ship out the frame.
NSParameterAssert(CMSampleBufferDataIsReady(sample Buffer));
NSParameterAssert([writerInput isReadyForMoreMediaData]);
BOOL success = [writerInput appendSampleBuffer:sampleBuffer];
Run Code Online (Sandbox Code Playgroud)

iphone video image avfoundation

26
推荐指数
1
解决办法
2万
查看次数

标签 统计

avfoundation ×1

image ×1

iphone ×1

video ×1