JJVideoManagerKit
https://github.com/ljj756640646/JJVideoManagerKit
JJVideoManagerKit是一个视频压缩压缩工具,支持音频压缩,视频压缩,可以设置具体压缩参数
cocosPod安装
pod'JJVideoManagerKit','〜> 1.0.2'
使用方法:
JJVideoCompression *compression = [[JJVideoCompression alloc]init]; // 创建对象compression.inputURL = ((AVURLAsset*)avasset).URL; // 视频输入路径compression.exportURL = [NSURL fileURLWithPath:[self getOutputPath]]; // 视频输出路径JJAudioConfigurations audioConfigurations;// 音频压缩配置audioConfigurations.samplerate = JJAudioSampleRate_11025Hz; // 采样率audioConfigurations.bitrate = JJAudioBitRate_32Kbps;// 音频的码率audioConfigurations.numOfChannels = 1;// 声道数audioConfigurations.frameSize = 8; // 采样深度compression.audioConfigurations = audioConfigurations;JJVideoConfigurations videoConfigurations;videoConfigurations.fps = 15; // 帧率 一秒中有多少帧videoConfigurations.videoBitRate = JJ_VIDEO_BITRATE_LOW; // 视频质量 码率videoConfigurations.videoResolution = JJ_VIDEO_RESOLUTION_SUPER; //视频尺寸compression.videoConfigurations = videoConfigurations;[compression startCompressionWithCompletionHandler:^(JJVideoCompressionState State) {if (State == JJ_VIDEO_STATE_FAILURE) {NSLog(@"压缩失败");}else{NSLog(@"压缩成功");}}];
网友评论