【问题标题】:How to get an AVCapture Timecode?如何获得 AVCapture 时间码?
【发布时间】:2011-06-14 14:35:25
【问题描述】:

我正在开发一个使用 AVFoundation 框架的视频捕获应用程序,基于 Apple 的 AVCam 示例。我想实现设置最大视频长度的功能,并在达到此限制时自动停止捕获(类似于UIImagePickerController.videoMaximumDuration)。

我假设我需要在捕获记录时注册一些通知,并检查此回调中的时间戳。我查看了 AV Foundation Programming Guide 并进行了一些谷歌搜索,但我找不到一种方法来检索 AVCaptureSession、AVCaptureMovieFileOutput 或 AVCaptureSomethingElse 的经过时间。

任何见解都会有所帮助。谢谢!

【问题讨论】:

  • 您是否查看过传入 CMSampleBuffers 的演示时间戳?哦等等,你没有说你是如何捕捉的。您使用的是 AVCaptureMovieFileOutput 还是 AVCaptureVideoDataOutput?

标签: iphone uiimagepickercontroller avfoundation avcapturesession avcapture


【解决方案1】:

您可以设置maxRecordedDurationmaxRecordedFileSize。但是,您需要确保在 captureOutput:didFinishRecordingToOutputFileAtURL:fromConnections:error: 委托调用中正确处理错误,以检测录制是由于错误还是由于达到最大持续时间/文件大小而停止。

检查错误代码,如:

if (([error code] == AVErrorMaximumDurationReached)) {
    [delegate captureSessionMaxDurationReached];
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-15
    • 2017-07-03
    • 2010-09-22
    相关资源
    最近更新 更多