Can i use AVAssetWriter in place of AVExportSession?

428 Views Asked by At

I want to crop the video given the lenght and width and x and y coordinates and it seems its not at possible with avmutablecomposition so I am planning to use AVAssetWriter to crop video using its aspectFill property in video setting.

BUT MY QUESTION is can we use AVAssetWriter as a replacement for AVExportSession ??

If yes, how to initialise the AVAssetWriterInput with AVAsset object as that we do in AVExportSession,Like this

[[AVAssetExportSession alloc] initWithAsset:videoAsset presetName:AVAssetExportPresetHighestQuality];
1

There are 1 best solutions below

0
On

It’s possible that what you are looking for is AVMutableComposition naturalSize property which from what it looks from here, allows scaling (not cropping) of the video to wished sizes.

https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVMutableComposition_Class/Reference/Reference.html#//apple_ref/occ/instp/AVMutableComposition/naturalSize