Awalz / SwiftyCam

A Snapchat Inspired iOS Camera Framework written in Swift
BSD 2-Clause "Simplified" License
2.08k stars 325 forks source link

Returning video as a .mp4 format #105

Open ryandailey100 opened 7 years ago

ryandailey100 commented 7 years ago

Is it possible to return the video in a .mp4 format rather than a .mov ? Please get back to me as soon as possible, thanks.

Jaspur commented 6 years ago

I get a .qt, how did you get a mov? mp4 is preferable

KKKKaras commented 6 years ago
    let avAsset = AVURLAsset.init(url: outputFileURL, options: nil)
 let tracks:NSArray = avAsset.tracks(withMediaType: AVMediaType.video) as NSArray

 let destinationPath = NSTemporaryDirectory() + fileName.mp4”
 let newVideoPath: NSURL = NSURL(fileURLWithPath: destinationPath as String)
 let exporter = AVAssetExportSession(asset: avAsset,
                                                presetName:AVAssetExportPresetHighestQuality)!
 exporter.outputURL = newVideoPath as URL
 exporter.outputFileType = AVFileType.mp4
 exporter.shouldOptimizeForNetworkUse = true
exporter.exportAsynchronously(completionHandler: {
print(“NewPath:\(String(describing: newVideoPath.relativePath))”)
        })