在iOS中,摄像头录制的视频是mov格式的,虽然mov兼容mp4,但是有些需求需要用到mp4格式的视频文件。
来源:互联网 发布:淘宝网上购物视频教程 编辑:程序博客网 时间:2024/05/23 21:57
AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:path] options:nil];NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:avAsset];if ([compatiblePresets containsObject:AVAssetExportPresetLowQuality]){AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:avAsset presetName:AVAssetExportPresetPassthrough]; NSString *exportPath = [NSString stringWithFormat:@"%@/%@.mp4", [NSHomeDirectory() stringByAppendingString:@"/tmp"], @"1"]; exportSession.outputURL = [NSURL fileURLWithPath:exportPath]; NSLog(@"%@", exportPath); exportSession.outputFileType = AVFileTypeMPEG4; [exportSession exportAsynchronouslyWithCompletionHandler:^{ switch ([exportSession status]) { case AVAssetExportSessionStatusFailed: NSLog(@"Export failed: %@", [[exportSession error] localizedDescription]); break; case AVAssetExportSessionStatusCancelled: NSLog(@"Export canceled"); break; case AVAssetExportSessionStatusCompleted: NSLog(@"转换成功"); break; default: break; } }];}
2 0
- 在iOS中,摄像头录制的视频是mov格式的,虽然mov兼容mp4,但是有些需求需要用到mp4格式的视频文件。
- mov 和 mp4 格式的区别
- iOS开发-进阶:MOV格式视频转MP4格式
- MOV转MP4格式
- QuickTimer Container(mov/mp4格式)
- MP4/MOV/3GP文件的“ftyp”
- cordova-plugin-camera 拍照改录像&ios的mov视频转mp4
- 苹果 mov avi 转 mp4 等格式
- MOV及MP4文件格式中几个重要的Table
- iOS视频转码 mov 转 mp4
- Android 录制的mp4视频文件在IOS中无法播放问题
- Android 录制的mp4视频文件在IOS中无法播放问题
- iOS UIImagePickerController录制视频转为mp4格式
- freeswith 录制 MP4格式视频
- iOS-视频格式转换(MOV->MP4)
- mp4容器格式需要注意的地方
- 在将视频转换成mp4格式的时候,需要做那些预设(presets)?
- MP4/MOV/3GP文件的“ftyp”(转)
- Android工程混淆时 ClassCastException 错误
- springMVC配置和使用
- Python pytesseract WinError 2
- [python]excel to xml
- shell 总结
- 在iOS中,摄像头录制的视频是mov格式的,虽然mov兼容mp4,但是有些需求需要用到mp4格式的视频文件。
- C语言的编译链接过程详解
- springMVC环境搭建过程总结
- 动画和图形概述
- 《Linux命令行与shell脚本编程大全》
- struts 后台线程单独处理问题传值问题
- 剑指offer 圆圈中最后剩下的数
- 关于linux的动态共享库的设置--/etc/ld.so.conf和/etc/ld.so.cache
- MD5加密代码