I am using AVAssetWriter to record video, and I want to be able to crop the video into a square with an offset at the top. Here is my code -
NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys: @320, AVVideoCleanApertureWidthKey, @320, AVVideoCleanApertureHeightKey, @10, AVVideoCleanApertureHorizontalOffsetKey, @10, AVVideoCleanApertureVerticalOffsetKey, nil]; NSDictionary *videoAspectRatioSettings = [NSDictionary dictionaryWithObjectsAndKeys: @3, AVVideoPixelAspectRatioHorizontalSpacingKey, @3,AVVideoPixelAspectRatioVerticalSpacingKey, nil]; NSDictionary *codecSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger:bitsPerSecond], AVVideoAverageBitRateKey, @1,AVVideoMaxKeyFrameIntervalKey, videoCleanApertureSettings, AVVideoCleanApertureKey,
Whenever I uncomment AVVideoScalingModeKey, my scripting resource gives me the error that you cannot apply the video composition settings. I tried using How to make a video with a reduced size using AVAssetWriter? but it still does not work for me.
source share