问题标签 [avcapturemoviefileoutput]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3226 浏览

iphone - 使用 AVCaptureSession 录制视频

我正在尝试使用 AVCaptureSession 和 AVCaptureMovieFileOutput 录制视频,但每当我尝试开始didFinishRecordingToOutputFileAtURL录制时,我都会在AVCaptureFileOutputRecordingDelegate 方法中收到此错误。

这是我用来添加 AVCaptureMovieFileOutput 并初始化我的 AVCaptureSession 的代码

我的 AVCaptureMovieFileOutput 像这样延迟加载

我不确定我做错了什么,因为我见过的大多数教程都是这样做的。

谢谢

0 投票
2 回答
486 浏览

iphone - iPhone 5S 上的 AVCaptureMovieFileOutput 崩溃

我的应用程序在 iPhone 5S 上崩溃,而不是在任何其他设备上崩溃,它指向 startRecordingToOutputFileURL:recordingDelegate 中引发的异常:

我没有要测试的 iPhone 5S,也不想为了这个目的而买一个。我检查了明显的错误,例如 nil 文件 URL、nil 委托,但没有一个被命中。

我该如何调试,有什么想法吗?是否有可能进行远程测试并从 beta 测试人员的设备中提取日志?我检查了大多数日志提取应用程序都无法在 iOS 7 上运行。

编辑:我强烈怀疑它与我设置 AVCaptureDevice 的方式有关。这是我的代码,请指出我是否正确。

这是我设置设备输入的方法。

0 投票
1 回答
504 浏览

ios - 如何将 AVCaptureMovieFileOutput 对象保存到 NSSavePanel

嗨,我必须将电影文件保存到自定义文件夹中,为此我使用的是 NSSavepanel。我是 NSSavepanel 的新手,所以我不知道如何将 AVCaptureMovieFileOutput 对象添加到 NSSavePanel

我的代码是

0 投票
2 回答
2596 浏览

ios - Stop Camera recording and save file when entering background

I've been looking for the answer for 2 days, but I can't seem to get it right...

I have an example app that records audio and video from the device using a AVCaptureSession and a AVCaptureMovieFileOutput.

When I start recording I call:

And it starts recording to the file. If I press the button again it stops recording

Everything works well, but when I enter background (incoming call or HOME press) I get an error in the delegate method: didFinishRecordingToOutputFileAtURL

My desired action should be saving / completing the file on entering the background. If I call stopRecording on "applicationDidEnterBackground" it will enter background before the applicationDidEnterBackground is called. On entering the active state it is called.... and generates an error and leaves a corrupted movie file...

It seems that it hasn't got enough time to save the file.

What am I missing here?

This is my Error

Error Domain=AVFoundationErrorDomain Code=-11818 "Recording Stopped" UserInfo=0x17594e20 {NSLocalizedRecoverySuggestion=Stop any other actions using the recording device and try again., NSUnderlyingError=0x175d3500 "The operation couldn’t be completed. (OSStatus error -16133.)", NSLocalizedDescription=Recording Stopped}

0 投票
1 回答
2238 浏览

objective-c - 如何从 AVCapture 中保存电影

过去几天我一直试图弄清楚 AVCapture 并且正在努力保存视频。我的理解是你打电话[movieFileOutput startRecordingToOutputFileURL:outputURL recordingDelegate:self];,然后在以后你可以打电话[movieFileOutput stopRecording];,然后它应该调用委托方法-(void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error{。之后,我应该可以用类似的东西保存电影,UISaveVideoAtPathToSavedPhotosAlbum([outputFileURL path] ,nil,nil,nil);但显然我做得不对。当我开始会话时,startRecordingToOutputFile它会立即调用 delegate didFinishRecording。我不知道为什么。这是我的代码:

很抱歉,它太长了。我希望很多这些代码对其他人有用。

0 投票
1 回答
8361 浏览

ios - 像 Instagram 一样暂停/恢复视频录制

我试图得到一些帮助。我想在 iOS 上暂停/恢复视频录制。但这非常复杂。我的目标是在 Instagram App 的应用程序中获得类似的东西(当你按下它的录音时)。我找到了“CapturePause”应用程序示例,但这对我来说非常复杂。很多流字节算法。对我来说太复杂了。

我尝试通过使用多个 AvCaptureMovieFileOutput 来开发解决方案,但它非常复杂。我正在失去理智。

有谁知道一个框架或一段代码可以很好地做到这一点?我在GG上搜索,我发现了一些东西。

谢谢,

阿尔诺

0 投票
1 回答
244 浏览

ios - 用于附加 .MOV 的 UIImagePickerController 流类型?

UIImagePickerController 中的 AVCaptureMovieFileOutput 在 iOS7 中使用什么流将来自相机的视频帧附加到它的临时 .MOV 文件中?

当用户通过 iOS7 中呈现的 UIImagePickerController 录制视频时,会在临时位置创建 .MOV 文件,然后由底层 AVCaptureMovieFileOutput 对象进一步附加。


我尝试使用符号断点和方法调配来确定以下其中一项(但没有成功)。我可能错过了实际使用的一种流类型或类(或者我的断点设置不正确):

  • NSWriteStream
  • CFWriteStream
  • 子类化 NSStream
  • 流的
  • ostream
  • iostream
  • NS文件句柄
  • posix 文件描述符
  • AVAssetWriter
  • AVAssertExportSession
  • ALAssetClass
  • ALA资产库

这就是我用来展示 UIImagePickerViewController 来录制视频的方法:

我真的需要特定的流类型和一种我可以为自己证明它正在被 iOS7 使用的方法。非常感谢!

0 投票
2 回答
6840 浏览

ios - iPad 上横向模式下的 AVCaptureSession 问题

我一直在尝试从前置摄像头捕捉帧并将其呈现在视图上。这是我的代码

问题是,当我的 iPad 是横向时,表示层上的图像会旋转 90 度。我该如何解决?我一直在浏览堆栈溢出,试图用 做一些事情AVCaptureConnection,但无济于事。

0 投票
5 回答
5870 浏览

ios - `[AVCaptureSession canAddOutput:output]` 间歇性返回 NO。我能找出原因吗?

canAddOutput:用来确定是否可以将 a 添加AVCaptureMovieFileOutput到 a 中AVCaptureSession,但我发现它canAddOutput:有时会返回 NO,并且大多返回 YES。有没有办法找出返回 NO 的原因?或者一种消除导致 NO 被退回的情况的方法?或者我能做的任何其他事情都会阻止用户看到间歇性故障?

一些进一步的说明:这大约在 30 次通话中发生一次。由于我的应用程序没有启动,它只在一台设备上进行了测试:运行 7.1.2 的 iPhone 5

0 投票
0 回答
2620 浏览

ios - AVCaptureMovieFileOutput 只为第一个视频录制音频

我正在使用 swift 开发一个应用程序,它可以精确地录制视频。在本例中为 7 秒。第一张唱片的所有作品都很棒,但后续唱片不包含音频,而只包含视频。我读了一些关于更改 AVCaptureMovieFileOutput 实例的 movieFragmentInterval 的内容,我尝试但没有任何改变。