avassetexportsession

Exporting mp4 through AVAssetExportSession fails

五迷三道 提交于 2020-01-01 05:36:27
问题 I start saying that I spent a lot of time searching through documentation, posts here and somewhere else, but I can't figure out the solution for this problem. I'm using AVAssetExportSession for exporting an .mp4 file stored in a AVAsset instance. What I do is: I check the isExportable property of AVAsset I then get an array of exportPresets compatible with the AVAsset instance I take the AVAssetExportPreset1920x1080 , or, if not existing I try to export the media with

Unable to trim a video using AVAssetExportSession

烈酒焚心 提交于 2019-12-30 01:29:26
问题 I want to trim a video: -(void)trimVideo:(NSURL*)outputURL { //[[NSFileManager defaultManager] removeItemAtURL:outputURL error:nil]; AVURLAsset *asset = [AVURLAsset URLAssetWithURL:outputURL options:nil]; AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality]; NSString * outputFilePath = NSHomeDirectory(); outputFilePath = [outputFilePath stringByAppendingPathComponent:@"Library"]; outputFilePath = [outputFilePath

AVAssetExportSession AVFoundationErrorDomain Code -11800 The operation could not be completed, NSOSStatusErrorDomain Code=-12780 "(null) in Swift iOS

老子叫甜甜 提交于 2019-12-24 21:09:59
问题 I am developing a Video based Application in Swift. Where I am exporting a Video clip with Watermark logo and Fade In Out effect. Here is my code: func watermark(video videoAsset:AVAsset, videoModal:VideoModel, watermarkText text : String!, imageName name : String!, saveToLibrary flag : Bool, watermarkPosition position : PDWatermarkPosition, withMode mode: SpeedoVideoMode, completion : ((_ status : AVAssetExportSessionStatus?, _ session: AVAssetExportSession?, _ outputURL : URL?) -> ())?) {

Overlaying image on video reduces video resolution

有些话、适合烂在心里 提交于 2019-12-24 20:33:03
问题 When I overlay an image on my video, the video quality is greatly reduced. If I don't set the video composition of the export session or set the export quality to passthrough, the video quality is great (but I get no overlays obviously). I'm passing in a local .mov video url to add the overlays too. I'm using PHPhotoLibrary to save the video to the camera roll. Using some other functions to transform the video and set its instructions. It all seems pretty straightforward, but something is

AVAssetReferenceRestrictions on iOS 13

ⅰ亾dé卋堺 提交于 2019-12-24 04:23:14
问题 Workspace: iOS 13.0, Xcode 11.0 TL;DR: Is there something wrong with AVAssetReferenceRestrictions in iOS 13? Part 1: In AVAsset.h , the AVAssetReferenceRestrictions are defined as: @enum AVAssetReferenceRestrictions @abstract These constants can be passed in to AVURLAssetReferenceRestrictionsKey to control the resolution of references to external media data. @constant AVAssetReferenceRestrictionForbidNone Indicates that all types of references should be followed. @constant

Add chapter information to existing video with AVFoundation

女生的网名这么多〃 提交于 2019-12-23 01:54:31
问题 I am trying to add chapter markers (text + images) to an existing video in iOS. Reading them is trivially easy with builtin functions: NSLocale * locale = [chapterLocalications lastObject]; NSLog(@"Locale: %@", [locale localeIdentifier]); NSArray *keys = @[AVMetadataCommonKeyTitle, AVMetadataCommonKeyArtwork]; NSArray *chapters = [asset chapterMetadataGroupsWithTitleLocale:locale containingItemsWithCommonKeys:keys]; for (AVTimedMetadataGroup * metadataGroup in chapters) { NSArray * items =

AVAssetExportSession giving me a green border on right and bottom of output video

血红的双手。 提交于 2019-12-20 12:15:24
问题 Here's the code: AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetHighestQuality]; exporter.outputURL = outputUrl; exporter.outputFileType = AVFileTypeQuickTimeMovie; exporter.videoComposition = mainComposition; exporter.shouldOptimizeForNetworkUse = YES; [exporter exportAsynchronouslyWithCompletionHandler:^{ //completion }]; I've tried different quality settings. I always get a 1-2 pixel border running down the right

iOS 6 issue Convert MPMediaItem to NSData

一笑奈何 提交于 2019-12-20 10:48:13
问题 i had tried the below code. -(void)mediaItemToData : (MPMediaItem * ) curItem { NSURL *url = [curItem valueForProperty: MPMediaItemPropertyAssetURL]; AVURLAsset *songAsset = [AVURLAsset URLAssetWithURL: url options:nil]; AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset presetName:AVAssetExportPresetPassthrough]; exporter.outputFileType = @"public.mpeg-4"; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

Progress bar for AVAssetExportSession

北慕城南 提交于 2019-12-20 09:54:08
问题 I've got an app that exports an AVMutableComposition into a .mov file, and I'd like for the user to see the status of the export with a progress bar the same way that you would if you sent a text message or uploaded a file. I know how to create a progress bar when I know the duration of a task (such as playing an audio file), but since there's no set duration for the export I'm unsure how to proceed. I've got an activity indicator currently but it doesn't provide the best user experience.

Create video with AVVideoCompositionCoreAnimationTool and AVAssetExportSession SLOW

ぃ、小莉子 提交于 2019-12-20 05:53:50
问题 I create an animation with layers and I want to export a video with that animations. So I use AVAssetExportSession, but it take a long time to export. Maybe I can use another thing? I really need help! let videoURL = NSURL.init(fileURLWithPath: "/Users/Downloads/img_2040.mp4") let audioURL = NSURL.init(fileURLWithPath: "/Users/Downloads/music_10sm.m4a") let videoAsset = AVURLAsset.init(url: videoURL as URL) let audioAsset = AVURLAsset.init(url: audioURL as URL) let mixComposition =