avasset

Create video with AVVideoCompositionCoreAnimationTool and AVAssetExportSession SLOW

回眸只為那壹抹淺笑 提交于 2019-12-02 09:06:34
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 = AVMutableComposition.init() let compositionVideoTrack = mixComposition.addMutableTrack(withMediaType:

Video Editing issues in iOS

廉价感情. 提交于 2019-12-02 06:24:45
问题 I am currently working on an iOS app which merges desired number of videos. Once the user taps the button to merge the videos, the videos are joined and then played using AVPlayer as: CMTime nextClipStartTime = kCMTimeZero; NSInteger i; CMTime transitionDuration = CMTimeMake(1, 1); // Default transition duration is one second. // Add two video tracks and two audio tracks. AVMutableCompositionTrack *compositionVideoTracks[2]; AVMutableCompositionTrack *compositionAudioTracks[2];

Possible for AVAssetWriter to write files with transparency?

删除回忆录丶 提交于 2019-12-01 10:52:52
Every file I write with AVAssetWriter has a black background, if the images I include do not fill the entire render area. Is there any way to write with transparency? Here's the method I use to get the pixel buffer: - (CVPixelBufferRef)pixelBufferFromCGImage:(CGImageRef)image { CGSize size = self.renderSize; NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey, [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey, nil]; CVPixelBufferRef pxbuffer = NULL; CVPixelBufferPoolCreatePixelBuffer

Convert PHAsset (video) to AVAsset, synchronously

≡放荡痞女 提交于 2019-11-30 12:02:30
I need to use the AVAsset object, in order to play it using AVPlayer and AVPlayerLayer. I started using the Photos framework since AssetsLibrary is deprecated. Now I got to the point where I have an array of PHAsset objects and I need to convert them to AVAsset. I tried enumerating through the PHFetchResult and allocation a new AVAsset using the PHAsset's localized description, but it does not seem to show any video when I play it. PHAssetCollection *assetColl = [self scaryVideosAlbum]; PHFetchResult *getVideos = [PHAsset fetchAssetsInAssetCollection:assetColl options:nil]; [getVideos

Applying a CIFilter to a Video File and Saving it

大兔子大兔子 提交于 2019-11-30 10:50:46
问题 Is there any fast, lightweight-as-possible way to apply a CIFilter to a video? Before it's mentioned, I have looked at GPUImage - it looks like very powerful magic code, but it's really overkill for what I'm trying to do. Essentially, I would like to Take a video file, say stored at /tmp/myVideoFile.mp4 Apply a CIFilter to this video file Save the video file to a different (or the same) location, say /tmp/anotherVideoFile.mp4 I've been able to apply a CIFilter to a video that's playing

Applying a CIFilter to a Video File and Saving it

ぐ巨炮叔叔 提交于 2019-11-29 22:39:10
Is there any fast, lightweight-as-possible way to apply a CIFilter to a video? Before it's mentioned, I have looked at GPUImage - it looks like very powerful magic code, but it's really overkill for what I'm trying to do. Essentially, I would like to Take a video file, say stored at /tmp/myVideoFile.mp4 Apply a CIFilter to this video file Save the video file to a different (or the same) location, say /tmp/anotherVideoFile.mp4 I've been able to apply a CIFilter to a video that's playing extremely easily and quickly using AVPlayerItemVideoOutput let player = AVPlayer(playerItem: AVPlayerItem

Convert PHAsset (video) to AVAsset, synchronously

风格不统一 提交于 2019-11-29 17:55:47
问题 I need to use the AVAsset object, in order to play it using AVPlayer and AVPlayerLayer. I started using the Photos framework since AssetsLibrary is deprecated. Now I got to the point where I have an array of PHAsset objects and I need to convert them to AVAsset. I tried enumerating through the PHFetchResult and allocation a new AVAsset using the PHAsset's localized description, but it does not seem to show any video when I play it. PHAssetCollection *assetColl = [self scaryVideosAlbum];

How to fix my orientation issue with merging videos from front and back camera

微笑、不失礼 提交于 2019-11-29 02:37:43
I am merging multiply videos (implantation of pause button) and everything working fine exept when merging video from back camera with video from front camera then one of the videos comes turned upside down in the new video(merged video). My code: let mixComposition = AVMutableComposition() let videoTrack = mixComposition.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: CMPersistentTrackID()) let trackAudio = mixComposition.addMutableTrackWithMediaType(AVMediaTypeAudio, preferredTrackID: CMPersistentTrackID()) var insertTime = kCMTimeZero for var i = 0; i < currentAssets.count;

How to fix video orientation issue in iOS

試著忘記壹切 提交于 2019-11-28 19:41:49
I am working with an app in which user picks video from Photos and uploads it to server. As my server is .Net server , the video gets rotated. I know the reason of problem is probably same as was in case of image (you may refer my earlier answer https://stackoverflow.com/a/10601175/1030951 ) , So i googled and got a code to fix video orientation , I got a code from RayWenderlich.com and modified in following way. Now my output video works fine but the video is mute. it plays but doesn't play audio. Kindly help me if I am missing something. I pass Info dictionary of -(void)imagePickerController

Getting same Video Thumbnail Image every time from the Url in Swift iOS

℡╲_俬逩灬. 提交于 2019-11-28 12:23:50
问题 I am developing a video based Application in Swift3. Where I have one video url and a Range Slider according to the video duration and user can select any minimum and maximum value from slider. If suppose user has selected min value 3 Sec and Max Value 7 Sec, So for this duration I need to generate a Video Thumbnail Image. For this I am using AVAssetImageGenerator to generate this, I tried below both code to achieve this : func createThumbnailOfVideoFromFileURL(_ strVideoURL: URL) -> UIImage?