======
This project have three main components: 1,QZAssetPicker; 2,QZVideoPreviewer; 3,QZVideoCompressor.
- In iOS7,the system's UIImagePicker can't filter assets flexible. By the QZAssetPicker, we can select asset from the local asset library with filter, the filter can set as allPhotos/allVideos/allAssets, and multiselect as well.
- The usally way to compress vedio is use AVAssetExportSession, and set its quality level. The AVAssetExportSession can only compress vedio into three quality levels (AVAssetExportPresetLowQuality/AVAssetExportPresetMediumQuality/AVAssetExportPresetHighQuality). This is not suitable for network transfer, although we can set the shouldOptimizeForNetworkUse property, it doesn't work. By the QZVideoCompressor, we use AssetReader to read the original asset, and then AssetWriter to compress the vedio. With this, we can config the compress setting flexible.(AVVideoAverageBitRateKey/AVVideoWidthKey/AVVideoHeightKey/AVVideoMaxKeyFrameIntervalKey...).
- The QZVideoPreviewer is used to preview the video asset select by QZAssetPicker. And it support range slider, used to clip time range of the vedio. It pass a parameter CMTime timeRange to the QZVideoCompressor; then the AssetReader just process the video in timeRange.
- iOS 6+,
- ARC.
- Drop
QZVideoCompressorfiles into your project. - Add
AssetsLibrary.framework,MediaPlayer.framework,AudioToolbox.framework,AVFoundation.framework, to your project. - Add below code to use it in a class.
#import "QZAssetsPickerController.h"
#import "QZLocalVideoCompressEngine.h"
#import "QZVideoPreviewController.h" QZAssetsPickerController *picker = [[QZAssetsPickerController alloc] init];
picker.maxinumSelection = 1;
picker.assetsFilter = AS_ALLVIDEOS;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:NULL];-(void)assetsPickerController:(QZAssetsPickerController *)picker didFinishPickingAssetUrl:(NSURL *)assetUrlThis project contains three main components, they work together to fullfill the "select-clip-compress" process, they can work independently for exactly purpose.
vectorcai
QZVideoCompressor is available under the MIT license. See the LICENSE file for more info.

