title: iOS 9 record video at 60fps
body: <p>Trying to record video at 60fps using AVFoundation and Swift, but code below is not working. Video still records at 30fps even though 60fps is set.</p>
  
  <pre><code>captureSession = AVCaptureSession()
  
  var finalFormat = AVCaptureDeviceFormat()
  var maxFps: Double = 0
  for vFormat in camera!.formats
  {
      var ranges      = vFormat.videoSupportedFrameRateRanges as!  [AVFrameRateRange]
      let frameRates  = ranges[0]
      if frameRates.maxFrameRate &gt;= maxFps &amp;&amp; frameRates.maxFrameRate &lt;= 60
      {
          maxFps = frameRates.maxFrameRate
          finalFormat = vFormat as! AVCaptureDeviceFormat
      }
  }
  
  print(String(maxFps) + " fps"); //prints 60 fps
  try camera!.lockForConfiguration()
  camera!.activeFormat = finalFormat
  camera!.activeVideoMinFrameDuration = CMTimeMake(1, 60)
  camera!.activeVideoMaxFrameDuration = CMTimeMake(1, 60)
  camera!.unlockForConfiguration()
  
  let video = try AVCaptureDeviceInput(device: camera) as AVCaptureDeviceInput
  captureSession!.addInput(video)
  
  let audio = try AVCaptureDeviceInput(device: AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeAudio)) as AVCaptureDeviceInput
  captureSession!.addInput(audio)
  
  fileOutput = AVCaptureMovieFileOutput()
  
  captureSession?.addOutput(fileOutput)
  
  captureSession!.startRunning()
  </code></pre>