Skip to content

Instantly share code, notes, and snippets.

@quangtqag
Created May 12, 2016 08:14
Show Gist options
  • Save quangtqag/7927d41f2dc3823a6a8d77faed8e3edc to your computer and use it in GitHub Desktop.
Save quangtqag/7927d41f2dc3823a6a8d77faed8e3edc to your computer and use it in GitHub Desktop.
func convertVideoToMP4WithInputURL(inputURL: NSURL, outputURL: NSURL, callback: (error: NSError?) -> ()) {
let asset = AVURLAsset(URL: inputURL)
let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetPassthrough)!
exportSession.outputURL = outputURL
exportSession.outputFileType = AVFileTypeMPEG4
exportSession.exportAsynchronouslyWithCompletionHandler {
callback(error: exportSession.error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment