2011-12-16 86 views
0

嗨發現很多很多的視頻編碼的鏈接通過的ffmpeg 1234等,但他們都開始使用終端的命令,但是當我試圖實現像終端的任何:FFMPEG爲iPhone錄製的視頻編碼

git clone git://github.com/lajos/iFrameExtractor.git it says that -bash:git:command not found。

也據我所知,它不可能在iPhone上使用終端命令。任何人都可以指出如何編碼通過ffmpeg格式錄製的視頻,並且還可以縮小視頻的大小?提前致謝。

編輯: 我已經實現這個方法來調整我的視頻的大小,它成功地發生,我能夠發送服務器上的視頻,但然後在服務器端它給檢索數據和使用它的問題。

- (void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
    [self convertVideoToLowQuailtyWithInputURL:videoURL1 outputURL:[NSURL fileURLWithPath:videoStoragePath] handler:^(AVAssetExportSession *exportSession) 
    { 
     if (exportSession.status == AVAssetExportSessionStatusCompleted) 
     { 
      NSLog(@"%@",exportSession.error); 
      printf("completed\n"); 
     } 
     else 
     { 
      NSLog(@"%@",exportSession.error); 
      printf("error\n"); 
     } 
    }]; 
} 

- (void)convertVideoToLowQuailtyWithInputURL:(NSURL*)inputURL 
            outputURL:(NSURL*)outputURL 
            handler:(void (^)(AVAssetExportSession*))handler 
{ 
    [[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil]; 
    AVURLAsset *asset = [AVURLAsset URLAssetWithURL:inputURL options:nil]; 
    AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality]; 
    exportSession.outputURL = outputURL; 
    exportSession.outputFileType = AVFileTypeQuickTimeMovie; 
    [exportSession exportAsynchronouslyWithCompletionHandler:^(void) 
    { 
     handler(exportSession); 
     [exportSession release]; 
    }]; 
} 

回答

2

的ffmpeg是過時的方法嘗試AVAssetWriterAVFoundation框架。

+0

感謝Tornado.I使用uiimagepicker在我的應用程序中錄製視頻,現在我想將其轉換爲mp4格式並將其發送到服務器上。 AVFoundation框架是一個很好的選擇嗎?它實際上不會讓我選擇看看我在錄製什麼。我該怎麼做? – Sarah 2011-12-16 07:05:06