I am Successful in encoding a series of image captured by AVCaptureVideoPreviewLayer of AVFoundation Framework into a Video using AVAssetWriter and AVAssetWriterInput.
But the size of the video is too large, Can anyone of you suggest me a tutorial or atleast a direct me in this case or give me the correct Video output Settings for video compression.
I am using the following VideoOutputSetting.
videoOutputSettings = @{
AVVideoCodecKey: AVVideoCodecH264,
AVVideoWidthKey: [NSNumber numberWithInt:width],
AVVideoHeightKey: [NSNumber numberWithInt:height],
AVVideoCompressionPropertiesKey: @{
AVVideoAverageBitRateKey: [NSNumber numberWithInt:bitrate],
AVVideoMaxKeyFrameIntervalKey: @(150),
AVVideoProfileLevelKey: AVVideoProfileLevelH264BaselineAutoLevel,
AVVideoAllowFrameReorderingKey: @NO,
AVVideoH264EntropyModeKey: AVVideoH264EntropyModeCAVLC,
AVVideoExpectedSourceFrameRateKey: @(30),
AVVideoAverageNonDroppableFrameRateKey: @(30)
}
};
videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
_videoWriterInput.expectsMediaDataInRealTime = YES;
来源:https://stackoverflow.com/questions/23342964/video-compression-ios-reduce-the-size-of-a-video-usin-avassetwriter