2016-03-22 92 views
9

我遇到了追蹤資產導出會話失敗背後隱藏問題的問題。這個問題只適用於一個視頻,而且我相信問題出現在它的音頻軌道上,因爲我成功導出了沒有音頻軌道(僅視頻軌道)的資產。對於特定視頻,AVAssetExportSession失敗,發生未知錯誤-12780

使用AVAssetReader對視頻軌道進行解碼,並在將樣本緩衝區重寫爲新的視頻軌道之前處理樣本緩衝區;音軌通過時不進行解碼也不進行任何中間處理。但是,即使不處理視頻採樣緩衝區,也會發生相同的故障。

我也試着用另一種方式來做 - 只有音頻和沒有視頻軌道 - 還有其他視頻工作得很好,這個特定的視頻失敗。我認爲視頻的音頻軌道存在固有的問題,但我無法推斷出問題所在,因此我無法解決。這裏是我的代碼:

AVAssetExportSession* assetExport = [[AVAssetExportSession alloc] initWithAsset:composition 
                     presetName:AVAssetExportPresetHighestQuality]; 

assetExport.outputFileType = @"com.apple.quicktime-movie"; 
assetExport.outputURL = [NSURL fileURLWithPath:path]; 

__weak typeof(self) weakSelf = self; 
[assetExport exportAsynchronouslyWithCompletionHandler:^{ 

    switch (assetExport.status) { 
     case AVAssetExportSessionStatusCompleted: NSLog(@"Asset combined"); 
      break; 
     case AVAssetExportSessionStatusFailed: NSLog(@"Asset combination failed"); 
      break; 
     default: NSLog(@"Asset combination completed with unknown status: %@", @(assetExport.status)); 
      break; 
    } 
}]; 

該問題應該是在資產導出會話;跟蹤插入到AVMutableComposition工作得很好。這裏的AVAssetExportSession的錯誤消息:

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" 
UserInfo={NSUnderlyingError=0x6040001338d0 {Error Domain=NSOSStatusErrorDomain Code=-12780 "(null)"}, 
NSLocalizedFailureReason=An unknown error occurred (-12780), NSLocalizedDescription=The operation could not be completed} 
+0

問題解決了嗎? –

+0

您是否得到了解決此問題的解決方案? –

回答

1

胡亂猜測:音軌從其擁有AVAsset,然後出去的範圍分離。嘗試保留音軌的參考號AVAsset,直到您致電exportAsynchronouslyWithCompletionHandler

相關問題