Я разрабатываю медиа-сервер для Play Station 3 на iPhone.
Я понял, что PS3 не поддерживает файл .MOV, поэтому мне нужно преобразовать его в Mp4 или что-то другое, что поддерживает PS3.
Это то, что я сделал, но он сбой, если я устанавливаю другой тип файла, чем его исходные файлы.
AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:videoURL options:nil];
NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:avAsset];
if ([compatiblePresets containsObject:AVAssetExportPresetLowQuality])
{
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:avAsset presetName:AVAssetExportPresetLowQuality];
exportSession.outputURL = [NSURL fileURLWithPath:videoPath];
exportSession.outputFileType = AVFileTypeMPEG4;
CMTime start = CMTimeMakeWithSeconds(1.0, 600);
CMTime duration = CMTimeMakeWithSeconds(3.0, 600);
CMTimeRange range = CMTimeRangeMake(start, duration);
exportSession.timeRange = range;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch ([exportSession status]) {
case AVAssetExportSessionStatusFailed:
NSLog(@"Export failed: %@", [[exportSession error] localizedDescription]);
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Export canceled");
break;
default:
break;
}
[exportSession release];
}];
}
Если я установил здесь AVFileTypeMPEG4, он сработает, указав "Недопустимый тип файла". Поэтому я должен установить его в AVFileTypeQuickTimeMovie, и он дает файл MOV.
Возможно ли в iOS конвертировать видео из MOV в Mp4 через AVAssetExportSession... ИЛИ без каких-либо библиотек Thirdparty?