avvideocomposition

Exporting AVCaptureSession video in a size that matches the preview layer

余生颓废 提交于 2019-12-04 09:34:34
问题 I'm recording video using AVCaptureSession with the session preset AVCaptureSessionPreset640x480 . I'm using an AVCaptureVideoPreviewLayer in a non-standard size (300 x 300) with the gravity set to aspect fill while recording. It's setup like this: self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:_captureSession]; _previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; _previewLayer.frame = _previewView.bounds; // 300 x 300 [_previewView.layer addSublayer:

How do make a reduced size video using AVAssetWriter?

白昼怎懂夜的黑 提交于 2019-12-03 02:04:47
问题 I would make reduced size video, maybe 50 pixel across and 75 pixels for length. Those are the physical dimension. How do you set that? in the videosettings? I think AVVideoWidthKey and AVVideoHeightKey are more for resolution not for physically dimension which what I needed. NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys: AVVideoCodecH264, AVVideoCodecKey, [NSNumber numberWithInt: 320], AVVideoWidthKey, [NSNumber numberWithInt:480], AVVideoHeightKey, nil];

Compositing 2 videos on top of each other with alpha

社会主义新天地 提交于 2019-12-02 18:39:14
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 shown. NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES]

Video rotated after applying AVVideoComposition

女生的网名这么多〃 提交于 2019-11-30 20:10:41
After applying an AVVideoComposition to my AVPlayerItem , the filter I apply does work, but the video gets rotated in the AVPlayerLayer . I know for a fact that the problem is not with the filtered frame because if I show the frame in a UIImageView , the frame is rendered 100% correctly. The video shows correctly until I apply a videoComposition . Setting the videoGravity on the AVPlayerLayer does not help. The video gets rotated 90º clockwise and gets stretched in the layer. Essentially, the video is displayed perfectly in the AVPlayerLayer before the AVPlayerItem is fed through the

AVPlayer plays video composition result incorrectly

醉酒当歌 提交于 2019-11-30 15:41:44
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: %@", NSStringFromCGAffineTransform(item.asset.preferredTransform)); Then I need to apply the video

Video rotated after applying AVVideoComposition

笑着哭i 提交于 2019-11-30 04:38:51
问题 After applying an AVVideoComposition to my AVPlayerItem , the filter I apply does work, but the video gets rotated in the AVPlayerLayer . I know for a fact that the problem is not with the filtered frame because if I show the frame in a UIImageView , the frame is rendered 100% correctly. The video shows correctly until I apply a videoComposition . Setting the videoGravity on the AVPlayerLayer does not help. The video gets rotated 90º clockwise and gets stretched in the layer. Essentially, the

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

时光总嘲笑我的痴心妄想 提交于 2019-11-28 23:45:37
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: AVMutableVideoComposition = AVMutableVideoComposition() videoComposition.frameDuration = CMTimeMake(1, 60)

iOS Video Editing - Is it possible to merge (side by side not one after other) two video files into one using iOS 4 AVFoundation classes?

给你一囗甜甜゛ 提交于 2019-11-28 16:45:39
I know you could merge multiple clips and create a single video by appending one after other using AVFoundation classes- AVURLAsset, AVMutableComposition, AVMutableCompositionTrack etc. There are apps like 'Video-Joiner' that do that. What I want to do is to juxtaposition 2 videos. My app idea - SelfInterviewer please don't steal :) First I record video 1 using front facing camera standing left to the frame. Then video 2 standing to the right. In video 1 ask a question and in video 2 I answer. When I merge, it should appear like I am being interviewed by myself. I am almost sure its not

I want to apply CIFilter on video and save that filter applied video. [export taking too much time]

别说谁变了你拦得住时间么 提交于 2019-11-28 12:39:19
问题 I want to apply CIFilter on video and save that filter applied video. I am using AVMutableVideoComposition (also tried with AVVideoComposition) for apply filter on video and its working fine with AVPlayer but when i am exporting filtered video then it takes too much time to save locally (20sec video taking arround 6-8 min). Please guide me what i am doing wrong... Thankyou ! let item = AVPlayerItem(asset: currentAsset!) let videoComposition = AVMutableVideoComposition(asset: currentAsset!) {

iOS Video Editing - Is it possible to merge (side by side not one after other) two video files into one using iOS 4 AVFoundation classes?

依然范特西╮ 提交于 2019-11-27 09:55:00
问题 I know you could merge multiple clips and create a single video by appending one after other using AVFoundation classes- AVURLAsset, AVMutableComposition, AVMutableCompositionTrack etc. There are apps like 'Video-Joiner' that do that. What I want to do is to juxtaposition 2 videos. My app idea - SelfInterviewer please don't steal :) First I record video 1 using front facing camera standing left to the frame. Then video 2 standing to the right. In video 1 ask a question and in video 2 I answer