2014-12-25 9 views
0

비디오를 서버로 업로드하기 전에 파일 크기를 줄이기 위해 비디오를 압축하는 방법에 대한 몇 가지 예제를 따르고 있습니다. 특히, 나는이 질문을 여기에서 보았다. How can I reduce the file size of a video created with UIImagePickerController?AVAssetWriter - iOS의 출력을 저장할 위치

그러나 출력을 저장하는 가장 좋은 곳은 어디인지 궁금하다.

심지어 AV 재단 프로그래밍 가이드는 단지 예로서이 제공

NSError *outError; 
NSURL *outputURL = <#NSURL object representing the URL where you want to save the video#>; 
AVAssetWriter *assetWriter = [AVAssetWriter assetWriterWithURL:outputURL 
                fileType:AVFileTypeQuickTimeMovie 
                error:&outError]; 
BOOL success = (assetWriter != nil); 

를 다시, 내가 비디오를 저장할 정확히 위치에 몇 가지 지침을 찾고!

건배, 브랜든

답변

0

이것은 문서 디렉토리의 URL, 당신의 이름에 추가 : 다른 모든 거의

[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; 

같은 : 라이브러리 (NSLibraryDirectory)

당신은에 파일을 쓸 수
0

아래의 코드를 사용하여 문서 디렉토리

defile 문서 디렉토리 경로

,
NSString *DocumentsDirectoryPath() {NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *documentsDirectoryPath = [paths objectAtIndex:0];return documentsDirectoryPath;} 

여기에 다음

NSURL * outputURL = [NSURL fileURLWithPath:[DocumentsDirectoryPath() stringByAppendingPathComponent:@"yourfilename.mp4"]]; 

mp4은 파일 확장자입니다.