title: Swift - Compressing video files
body: <p>So, at the moment I am using this to compress video:</p>
  
  <pre><code>func compressVideo(inputURL: NSURL, outputURL: NSURL, handler:(session: AVAssetExportSession)-&gt; Void)
      {
          let urlAsset = AVURLAsset(URL: inputURL, options: nil)
  
          let exportSession = AVAssetExportSession(asset: urlAsset, presetName: AVAssetExportPresetMediumQuality)
  
          exportSession!.outputURL = outputURL
  
          exportSession!.outputFileType = AVFileTypeQuickTimeMovie
  
          exportSession!.shouldOptimizeForNetworkUse = true
  
          exportSession!.exportAsynchronouslyWithCompletionHandler { () -&gt; Void in
  
              handler(session: exportSession!)
          }
  
      }
  </code></pre>
  
  <p>When I recorded a video in 2 seconds, the size was <strong>4,3 MB</strong> and when I recorded a video in 6 seconds the file size was <strong>9,3 MB</strong>.</p>
  
  <p>Any tips to reduce the size?</p>