2015-01-20 2 views
1

미리보기 레이어가있는 사용자 정의 카메라를 설정하고 있습니다. 모든 것이 작동합니다. 방향과 모든 것을 설정합니다. 자동 초점 설정 방법을 묻고 싶습니다. 둘째로, 비디오를 녹화하기 위해 카메라를 시작하는 방법은 무엇입니까? (왜냐하면 앞 카메라가 보여주는 것을 보여주기 때문에 당신을 보게됩니다.) ...하지만 녹화를 시작하고 싶습니다.비디오 레코딩 시작 방법 AVCaptureVideoPreviewLayer

나는 Swift에서 코드를 선호하지만, Objective C에서 그 코드를 확인하면 번역이됩니다. 감사합니다! Apple's Audio/Video capture documentation에서

답변

1

,

것은 동영상 파일로 저장 :

당신은 AVCaptureMovieFileOutput 객체를 사용하여 파일에 동영상 데이터를 저장합니다. (AVCaptureMovieFileOutput은 기본 동작의 대부분을 정의하는 AVCaptureFileOutput의 구체적인 하위 클래스입니다.) 최대 녹화 지속 시간 또는 최대 파일 크기와 같은 동영상 파일 출력의 다양한 측면을 구성 할 수 있습니다. 주어진 디스크 공간보다 적은 공간이 남아 있으면 녹음을 금지 할 수도 있습니다. didFinishRecordingToOutputFileAtURL : fromConnections 다음 captureOutput의 구현에서

AVCaptureMovieFileOutput *aMovieFileOutput = [[AVCaptureMovieFileOutput alloc] init]; 

CMTime maxDuration = <#Create a CMTime to represent the maximum duration#>; 
aMovieFileOutput.maxRecordedDuration = maxDuration; 
aMovieFileOutput.minFreeDiskSpaceLimit = <#An appropriate minimum given the quality of the movie format and the duration#>; 
The resolution and bit rate for the output depend on the capture session’s sessionPreset. The video encoding is typically H.264 and audio encoding is typically AAC. The actual values vary by device.* 

AVCaptureMovieFileOutput *aMovieFileOutput = <#Get a movie file output#>; 
NSURL *fileURL = <#A file URL that identifies the output location#>; 
[aMovieFileOutput startRecordingToOutputFileURL:fileURL recordingDelegate:<#The delegate#>]; 

대리인 :, 오류가 카메라 롤 앨범에 결과 동영상을 작성할 수 있습니다. 또한 발생할 수있는 오류를 확인해야합니다.

관련 문제