avassetexportsession

Simulate AVLayerVideoGravityResizeAspectFill: crop and center video to mimic preview without losing sharpness

岁酱吖の 提交于 2019-12-19 10:47:38
问题 Based on this SO post, the code below rotates, centers, and crops a video captured live by the user. The capture session uses AVCaptureSessionPresetHigh for the preset value, and the preview layer uses AVLayerVideoGravityResizeAspectFill for video gravity. This preview is extremely sharp. The exported video, however, is not as sharp, ostensibly because scaling from the 1920x1080 resolution for the back camera on the 5S to 320x568 (target size for the exported video) introduces fuzziness from

Writing ID3 tags via AVMetaDataItem

99封情书 提交于 2019-12-19 03:57:04
问题 I'm writing ID3 tags to a file using AVMetaDataItem var soundFileMetadata = [AVMetadataItem]() soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyArtist, "MyArtist")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeySongName, "MySong")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyAlbum, "MyAlbum")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyUserGenre, "MyGenre")!) soundFileMetadata.append(createMetadata

Swift - Compressing video files

微笑、不失礼 提交于 2019-12-17 16:22:09
问题 So, at the moment I am using this to compress video: func compressVideo(inputURL: NSURL, outputURL: NSURL, handler:(session: AVAssetExportSession)-> 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!

AVAssetExportSession export fails non-deterministically with error: “Operation Stopped, NSLocalizedFailureReason=The video could not be composed.”

為{幸葍}努か 提交于 2019-12-17 15:57:06
问题 We add subtitles to a video recorded by the user, but the export by our AVAssetExportSession object fails non-deterministically: sometimes it works, and sometimes it doesn't. It's unclear even how to reproduce the error. We noticed the asset tracks seem to get lost during export. Before exporting, there are two tracks (one for audio, one for video) as expected. But checking the number of tracks for the same file URL in exportDidFinish shows 0 tracks. So something seems wrong with the export

AVPlayer playback fails while AVAssetExportSession is active as of iOS 10

亡梦爱人 提交于 2019-12-17 15:42:38
问题 AVPlayer will randomly just play audio, not showing the video track... Playing video correctly with AVPlayer while having an active compression session of AVAssetExportSession:exportAsynchronouslyWithCompletionHandler is now failing. It seems it causes some instability that persists until the app goes into the background and comes back. Examining AVURLAsset when video playback fails, there is a video track even though there is no video output. I also don't get any errors from the compressor

AVAssetExportSession exportAsynchronouslyWithCompletionHandler returns failed

末鹿安然 提交于 2019-12-13 02:02:39
问题 I'm implementing AVAssetExportSession to trim a video online but always returns failed. Here is my implementation: NSString *url = @"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"; NSURL *fileURL = [NSURL URLWithString:url]; AVAsset *asset = [AVAsset assetWithURL:fileURL]; AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetHighestQuality]; NSURL *exportUrl = [NSURL fileURLWithPath:[documentsDirectory

AVAssetExportSession working in background

痴心易碎 提交于 2019-12-12 23:42:28
问题 I tried to manage AVAssetExportSession working when app in background. I have iOS 6 device and testing it there. So i m making audio mix and trying to export audio. When app is in foreground i m making all OK, but if i m going to background i m getting AVAssetExportSessionStatusFailed and have to create it from beginning. So, is it ever possible to make audio mixing work in background? I m trying to make [exportSession exportAsynchronouslyWithCompletionHandler: ] in NSOperationQueue or

How can I export an mp3 file from an iOS device's iPod library?

别说谁变了你拦得住时间么 提交于 2019-12-12 08:35:05
问题 In my iOS application I'm trying to export an mp3 file from the iPod library to the app's documents directory on the device. Currently I'm trying to use AVAssetExportSession but it's not working for mp3 files. It works well for m4a files. Is exporting an mp3 file possible using AVAssetExportSession? What is the appropriate outputFileType for AVAssetExportSession? ( AVFileTypeAppleM4A works for m4a files) Thanks! 回答1: I am facing the same problem. Unfortunately, non of the iOS frameworks

Error Domain=NSOSStatusErrorDomain Code=-12780 \“(null)\”

放肆的年华 提交于 2019-12-12 05:49:13
问题 When I try to export the asset with AVAssetExport I get the following error only on videos received through whatsapp probably. I could not find a working solution. I've also tried implementing code to fix video duration, but I did not fix it. Error is : Error Domain=NSOSStatusErrorDomain Code=-12780 \"(null)\" Here code PHCachingImageManager().requestAVAsset(forVideo: asset.phAsset!, options: nil, resultHandler: { (AVAssetRecivied, audioMix, info) in let AVAssetMy = AVAssetRecivied!

AVVideoCompositionCoreAnimationTool not adding all CALayers

烂漫一生 提交于 2019-12-12 01:27:12
问题 Okay, this one has me completed stumped. I'm happy to post other code if you need it but I think this is enough. I cannot for the life of me figure out why things are going wrong. I'm adding CALayers, which contain images, to a composition using AVVideoCompositionCoreAnimationTool. I create an NSArray of all the annotations (see interface below) I want to add and then add them to the animation layer with an enumerator. No matter how many, as far as I can tell, annotations are in the array,