Swift Video Resizer AVAsset
<p>I have this code that resizes a video from 1280 x 720 to 640 x 360
But i want a resize with no crop.</p>

<p>Is there a way to do a full resize the don't crop ?</p>

<p>Here's the code</p>

<pre><code>class func resizer(inputURL : NSURL , completion: (outPutURL : NSURL?) -&gt; Void ){
        let videoAsset = AVAsset(URL: inputURL) as AVAsset
        let clipVideoTrack = videoAsset.tracksWithMediaType(AVMediaTypeVideo).first! as AVAssetTrack

        let composition = AVMutableComposition()
        composition.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: CMPersistentTrackID())

        let videoComposition = AVMutableVideoComposition()
        videoComposition.renderSize = CGSizeMake(360,640)
        videoComposition.frameDuration = CMTimeMake(1, 30)

        let instruction = AVMutableVideoCompositionInstruction()
        instruction.timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(180, 30))

        let transformer : AVMutableVideoCompositionLayerInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: clipVideoTrack)

        let t1 = CGAffineTransformMakeTranslation(360, 0)
        let t2 = CGAffineTransformRotate(t1, CGFloat(M_PI_2))
//        let t2 = CGAffineTransformMakeRotation(CGFloat(M_PI_2))
        transformer.setTransform(t2, atTime: kCMTimeZero)
        instruction.layerInstructions = [transformer]
        videoComposition.instructions = [instruction]


        let formatter = NSDateFormatter()
        formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
        let date = NSDate()

        let tempDir = NSTemporaryDirectory().stringByAppendingString(formatter.stringFromDate(date))
        let d = "\(tempDir).mp4"
        let outputURL = NSURL(fileURLWithPath: d)

        let exporter = AVAssetExportSession(asset: videoAsset, presetName: AVAssetExportPresetHighestQuality)
        exporter!.videoComposition = videoComposition
        exporter!.outputURL = outputURL
        exporter!.outputFileType = AVFileTypeQuickTimeMovie

        exporter?.exportAsynchronouslyWithCompletionHandler({ () -&gt; Void in
            dispatch_async(dispatch_get_main_queue(), {
                completion(outPutURL: outputURL)
            })
        })
    }
</code></pre>