如何使用AVCaptureVideoDataOutput保存视频(mp4格式)?

时间:2013-03-18 13:33:18

标签: ios avfoundation avcapturesession avcapture

我已经设置了输入,AVCapture会话的输出以及代理

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection

正在被召唤。如何将帧转换为mp4视频文件并保存?

1 个答案:

答案 0 :(得分:2)

使用AVAssetWriter压缩数据并写入MP4。这两个示例包含执行此操作的代码:

http://www.gdcl.co.uk/2013/02/20/iPhone-Pause.html

http://www.gdcl.co.uk/2013/02/20/iOS-Video-Encoding.html