Shi*_*sad 0 cocoa-touch avfoundation ios
iPhone中是否有任何压缩技术可以使用AVfoundation压缩视频.或任何开源.
此致,Jeeva
试试这个 :)
+ (void)convertVideoToLowQualityWithInputURL:(NSURL*)inputURL outputURL:(NSURL*)outputURL successHandler:(void (^)())successHandler failureHandler:(void (^)(NSError *))failureHandler
{
if([[NSFileManager defaultManager] fileExistsAtURL:outputURL]) [[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) {
if (exportSession.status == AVAssetExportSessionStatusCompleted)
{
successHandler();
}
else
{
NSError *error = [NSError errorWithDomain:domain code:code userInfo:userInfo];
failureHandler(error);
}
}];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8559 次 |
| 最近记录: |