avassetexportsession

How to properly export CALayer on top of AVMutableComposition with AVAssetExportSession

时光总嘲笑我的痴心妄想 提交于 2019-11-28 18:58:16
I know this question was asked before (for example here and here ) but I just can't figure out what I'm doing wrong. I have an AVMutableComposition that I use to combine some video clips with some CALayer s that animate on top of them. Everything works ok when I take my AVMutableComposition and combine it with an AVSynchronizedLayer for playback inside an AVPlayerLayer . The video comes out correctly and everything is positioned where it should. My problem is that when I tried to export this thing I tried using AVVideoCompositionCoreAnimationTool instead of AVSynchronizedLayer (that's what the

Square cropping and fixing the video orientation in iOS

China☆狼群 提交于 2019-11-28 18:02:32
I am capturing the video using UIImagePickerController, i can crop the video using the following code, AVAsset *asset = [AVAsset assetWithURL:url]; //create an avassetrack with our asset AVAssetTrack *clipVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; //create a video composition and preset some settings AVMutableVideoComposition* videoComposition = [AVMutableVideoComposition videoComposition]; videoComposition.frameDuration = CMTimeMake(1, 30); //here we are setting its render size to its height x height (Square) videoComposition.renderSize = CGSizeMake

Cropping AVAsset video with AVFoundation

﹥>﹥吖頭↗ 提交于 2019-11-28 16:15:41
I am using AVCaptureMovieFileOutput to record some video. I have the preview layer displayed using AVLayerVideoGravityResizeAspectFill which zooms in slightly. The problem I have is that the final video is larger, containing extra image that didn't fit on the screen during preview. This is the preview and resulting video Is there a way I can specify a CGRect that I want to cut from the video using AVAssetExportSession ? EDIT ---- When I apply a CGAffineTransformScale to the AVAssetTrack it zooms into the video, and with the AVMutableVideoComposition renderSize set to view.bounds it crops off

AVAssetExportSession in ios 10 not working for iPhone 7

巧了我就是萌 提交于 2019-11-28 10:23:13
问题 When I am blending two videos with AVAssetExportSession in ios 9 its working perfectly. but when i blend with AVAssetExportSession in iOS 10, it in not working. Please help me if any know the reason, Thank you. actualy code is working for iphone 6s and earlier, but not for working for iPhone 7 for example -(void) blendVideoOverVideo:(NSURL*)mainVideoUrl andBlendVideoUrl:(NSURL*)liveEffectUrl { AVURLAsset *mainVideoUrlAsset =[AVURLAsset URLAssetWithURL:mainVideoUrl options:nil]; //

Setting multiple Volumes to each Video tracks using AudioMixInputParameters AVFoundation is not working in Swift iOS

房东的猫 提交于 2019-11-28 09:37:14
问题 I am working on Video based Application in Swift . As per the requirement I have to select multiple Videos from Device Gallery , setting up different different CIFilter effects and Volume for each Video Asset and then merge all the Videos and have to Save the Final Video . As an output, when I will play the Final Video then Video sound volume should change accordingly. I have already merged all the selected Video Assets into one with different different CIFilter effects but my problem is when

Starting AVAssetExportSession in the Background

旧时模样 提交于 2019-11-28 00:13:50
问题 My app does some processing and at some point it needs to call an AVAssetExportSession. If the session has already started and then I background the app, everything completes normally. However, if I background the app before calling exportAsynchronouslyWithCompletionHandler . I get this error: AVAssetExportSessionStatusFailed Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1e550db0 {NSLocalizedFailureReason=An unknown error occurred (-12985),

AVPlayer playback fails while AVAssetExportSession is active as of iOS 10

﹥>﹥吖頭↗ 提交于 2019-11-27 19:32:52
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 or the other playback components... The problem happens even for a while after the compression session

How to trim the video file and convert to 15 seconds video with iOS SDK?

那年仲夏 提交于 2019-11-27 15:13:34
问题 I want to trim a video file. I want to just pick the video from a gallery and convert it to a 15-second video. If I use normal trimming with picker view controller, it does not specify a time and just shows the frames, but I need to be fixed for 15 seconds. How can I achieve this? 回答1: Objective-C -(void)cropVideo:(NSURL*)videoToTrimURL{ AVURLAsset *asset = [AVURLAsset URLAssetWithURL:videoToTrimURL options:nil]; AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]

How to properly export CALayer on top of AVMutableComposition with AVAssetExportSession

China☆狼群 提交于 2019-11-27 11:01:07
问题 I know this question was asked before (for example here and here) but I just can't figure out what I'm doing wrong. I have an AVMutableComposition that I use to combine some video clips with some CALayer s that animate on top of them. Everything works ok when I take my AVMutableComposition and combine it with an AVSynchronizedLayer for playback inside an AVPlayerLayer . The video comes out correctly and everything is positioned where it should. My problem is that when I tried to export this

Swift 3: How to add watermark on video ? AVVideoCompositionCoreAnimationTool iOS 10 issue

旧街凉风 提交于 2019-11-27 02:19:59
问题 This code used to work on iOS9 to add a watermark and text to a video but since iOS10 it's not working anymore. There is a iOS 10 bug that has been filed but no answer from Apple. I have not been able to implement any workaround to add watermark and text on video. With this code some times the video will be exported successfully but most of time it won't be exported. How should I use AVVideoCompositionCoreAnimationTool so that it works as it did on iOS9. let videoComposition: