avvideocomposition

AVAssetImageGenerator returns sometimes same image from 2 successive frames

时间秒杀一切 提交于 2020-06-09 12:52:27
问题 I'm currently extracting every frame from a video with AVAssetImageGenerator , but sometimes it returns me successively 2 times almost the same image (they do not have the same "frame time"). The funny thing is it always happen (in my test video) each 5 frames. Here and here are the two images (open each in new tab then switch the tabs to see the differences). Here's my code : //setting up generator & compositor self.generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset];

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

Compositing 2 videos on top of each other with alpha

不羁岁月 提交于 2019-12-20 09:25:36
问题 AVFoundation allows you to "compose" 2 assets (2 videos) as 2 "tracks", just like in Final Cut Pro, for example. The theory says I can have 2 videos on top of each other, with alpha, and see both. Either I'm doing something wrong, or there's a bug somewhere, because the following test code, although a bit messy, clearly states I should see 2 videos, and I only see one, as seen here: http://lockerz.com/s/172403384 -- the "blue" square is IMG_1388.m4v For whatever reason, IMG_1383.MOV is never

AVPlayer plays video composition result incorrectly

末鹿安然 提交于 2019-12-18 17:49:20
问题 I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@"

AVPlayer plays video composition result incorrectly

房东的猫 提交于 2019-12-18 17:49:14
问题 I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@"

Updating AVPlayerItem video composition

倾然丶 夕夏残阳落幕 提交于 2019-12-18 09:09:07
问题 Me and my team are stuck on an issue for a few days now. We have AVPlayer which plays AVPlayerItem with a custom AVVideoComposition . player.currentItem?.videoComposition = getUpdatedVideoComisition() The user can decide if to remove or keep the composition. I'm trying to remove the composition by calling player.currentItem?.videoComposition = nil But in an unexpected way even when assigning nil to the videoComposition property, it's keep on playing with the same composition. How can we

AVAssetExportSession is greatly reducing video quality

ぐ巨炮叔叔 提交于 2019-12-11 06:35:48
问题 I have a local video url that I am trying to put an overlay on. It all works properly, but the quality of the video is being drastically reduced upon export. I have narrowed it down to find that it happens when I set the AVAssetExportSession.videoComposition (which I need to do for the overlay). If I set the export preset quality to Passthrough, then the video doesn't lose quality but the overlays don't appear. func merge3(url: URL) { activityMonitor.startAnimating() let firstAsset = AVAsset

Swift 3 : How to export video with text using AVVideoComposition

一曲冷凌霜 提交于 2019-12-07 12:41:46
问题 I am trying to use AVVideoComposition to add some text on top of a video and save the video. This is the code I use: I Create an AVMutableComposition and AVVideoComposition var mutableComp = AVMutableComposition() var mutableVidComp = AVMutableVideoComposition() var compositionSize : CGSize? func configureAsset(){ let options = [AVURLAssetPreferPreciseDurationAndTimingKey : "true"] let videoAsset = AVURLAsset(url: Bundle.main.url(forResource: "Car", withExtension: "mp4")! , options : options)

Swift 3 : How to export video with text using AVVideoComposition

穿精又带淫゛_ 提交于 2019-12-06 04:04:55
I am trying to use AVVideoComposition to add some text on top of a video and save the video. This is the code I use: I Create an AVMutableComposition and AVVideoComposition var mutableComp = AVMutableComposition() var mutableVidComp = AVMutableVideoComposition() var compositionSize : CGSize? func configureAsset(){ let options = [AVURLAssetPreferPreciseDurationAndTimingKey : "true"] let videoAsset = AVURLAsset(url: Bundle.main.url(forResource: "Car", withExtension: "mp4")! , options : options) let videoAssetSourceTrack = videoAsset.tracks(withMediaType: AVMediaTypeVideo).first! as AVAssetTrack

Custom AVVideoCompositing class not working as expected

坚强是说给别人听的谎言 提交于 2019-12-04 17:24:27
问题 I'm attempting to apply a CIFilter to an AVAsset, and then save it with the filter applied. The way that I am doing this is by using an AVAssetExportSession with videoComposition set to an AVMutableVideoComposition object with a custom AVVideoCompositing class. I am also setting the instructions of my AVMutableVideoComposition object to a custom composition instruction class (conforming to AVMutableVideoCompositionInstruction). This class is passed a track ID, along with a few other