Tôi đang phát triển máy chủ phương tiện cho Play station 3 trong iPhone.MOV để chuyển đổi video Mp4 iPhone Lập trình
Tôi biết rằng PS3 không hỗ trợ tệp .MOV vì vậy tôi phải chuyển đổi nó thành Mp4 hoặc một số mã chuyển tiếp khác mà PS3 hỗ trợ.
Đây là những gì tôi đã làm nhưng nó bị treo nếu tôi đặt loại tệp khác với tệp nguồn của nó.
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];
}];
}
Nếu tôi đặt AVFileTypeMPEG4 ở đây thì nó đổ vỡ, nói "Loại tệp không hợp lệ". Vì vậy, tôi phải thiết lập nó để AVFileTypeQuickTimeMovie và nó mang lại cho tập tin MOV.
Có thể trong iOS chuyển đổi video từ MOV sang Mp4 thông qua AVAssetExportSession ... HOẶC không có thư viện Thirdparty nào không?
Bạn đã bao giờ nhận được một giải pháp cho việc này? – newenglander
Bạn có giải pháp cho chuyển đổi này không ??? – svmrajesh
Bạn không thể đọc bất kỳ codec .mov ngẫu nhiên nào trên iOS, chỉ có video h.264 được mã hóa dưới dạng .mov/.m4v có thể đọc được bằng AVFoundation. – MoDJ