avmutablecomposition

Using AVMutableComposition iPhone

北慕城南 提交于 2019-12-02 02:44:16
I am using the below code, for streaming the two videos sequentially. But it is not showing any video in the simulator, its totally blank. Also how can I seek through these two videos. Like, if one video is of 2 minutes and the second is 3 minutes. Now I need to get the total time of these videos and seek through them. When I slide the slider bar to 4 minutes so the 2nd video should be played from minute 2 to onward. Is it possible? - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSURL *url1 = [NSURL URLWithString:@"http://www

Merging two m4v Movie Files Using AVMutableComposition - Videos Will Not Merge

泪湿孤枕 提交于 2019-12-02 01:59:37
I am using the below code to try and merge two m4v files stored in the documents folder : CMTime insertionPoint = kCMTimeZero; NSError * error = nil; AVMutableComposition *composition = [AVMutableComposition composition]; AVURLAsset* asset = [AVURLAsset URLAssetWithURL: [assetURLArray objectForKey:kIntroVideo] options:nil]; if (![composition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration) ofAsset:asset atTime:insertionPoint error:&error]) { NSLog(@"error: %@",error); } insertionPoint = CMTimeAdd(insertionPoint, asset.duration); AVURLAsset* asset2 = [AVURLAsset URLAssetWithURL:

iOS - Reversing video file (.mov)

戏子无情 提交于 2019-12-01 16:45:15
Requirement : It sounds like litte different but this is what I want to achieve. I want to make movie (.mov) file in reverse. Just like how we rewind the movie file. I also want maintain same frame rate as my video is containing. NOTE: I do not just want to play video file in reverse order. I want to generate new movie file playing in reverse order. My Exploration : I thought of below steps to perform to do the same. Make chunks of video files with specific frame rate using AVAssetExportSession Merge all these video chunks into single movie file using AVMutableComposition and

iOS - Reversing video file (.mov)

偶尔善良 提交于 2019-12-01 15:47:30
问题 Requirement : It sounds like litte different but this is what I want to achieve. I want to make movie (.mov) file in reverse. Just like how we rewind the movie file. I also want maintain same frame rate as my video is containing. NOTE: I do not just want to play video file in reverse order. I want to generate new movie file playing in reverse order. My Exploration : I thought of below steps to perform to do the same. Make chunks of video files with specific frame rate using

Setting AVMutableComposition's frameDuration

我与影子孤独终老i 提交于 2019-11-30 09:54:45
I'm playing with the AVEditDemo project, from Apple's WWDC 2010 sample pack, and I'm trying to change the frame rate of the exported video. The video is exported using an AVMutableComposition on which the frameDuration is set like that: videoComposition.frameDuration = CMTimeMake(1, 30); // 30 fps For some reason, changing the 30 to 25 does not change the framerate of the video exported with the AVAssetExportSession . Does anyone have an idea why? MonsieurDart It seems that the AVAssetExportSession preset takes precedence over the AVVideoComposition frameDuration . I've opened a bug report:

Overlay Two Videos with AVFoundation

[亡魂溺海] 提交于 2019-11-29 22:45:13
问题 I am trying to overlay two videos, with the foreground video being somewhat alpha transparent. I have been following the Apple Docs as well as This tutorial. Whenever I try putting two of the same video through my code it doesn't crash; however, when I try feeding it two different videos I receive this error: VideoMaskingUtils.exportVideo Error: Optional(Error Domain=AVFoundationErrorDomain Code=-11841 "Operation Stopped" UserInfo={NSLocalizedDescription=Operation Stopped,

AVMutableComposition - Blank/Black frame between videos assets

…衆ロ難τιáo~ 提交于 2019-11-29 15:18:03
问题 I'm currently trying to put 5 videos back to back using AVMutableComposition like so: [mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset1.duration) ofAsset:asset1 atTime:[mixComposition duration] error:nil]; [mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset2.duration) ofAsset:asset2 atTime:[mixComposition duration] error:nil]; [mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset3.duration) ofAsset:asset3 atTime:[mixComposition duration] error:nil

Extract audio from video file

泪湿孤枕 提交于 2019-11-29 15:14:17
问题 How can I extrace Audio from Video file without using FFmpeg ? I want to use AVMutableComposition and AVURLAsset for solving it.e.g. conversion from .mov to .m4a file. 回答1: The following Swift 5 / iOS 12.3 code shows how to extract audio from a movie file ( .mov ) and convert it to an audio file ( .m4a ) by using AVURLAsset , AVMutableComposition and AVAssetExportSession : import UIKit import AVFoundation class ViewController: UIViewController { @IBAction func extractAudioAndExport(_ sender:

Setting AVMutableComposition's frameDuration

泄露秘密 提交于 2019-11-29 15:01:55
问题 I'm playing with the AVEditDemo project, from Apple's WWDC 2010 sample pack, and I'm trying to change the frame rate of the exported video. The video is exported using an AVMutableComposition on which the frameDuration is set like that: videoComposition.frameDuration = CMTimeMake(1, 30); // 30 fps For some reason, changing the 30 to 25 does not change the framerate of the video exported with the AVAssetExportSession . Does anyone have an idea why? 回答1: It seems that the 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