avcomposition

AVAssetExportSession - Join 2 mp4 files in IOS

本小妞迷上赌 提交于 2019-12-11 13:35:08
问题 I am trying to join 2 preexisting mpeg4 video's together on an ipad2 with the following code. -(void)mergeTestVideos { //setup asset NSString *firstassetpath = [NSString stringWithFormat:@"%@mpeg4-1.mp4", NSTemporaryDirectory()]; NSString *secondassetpath = [NSString stringWithFormat:@"%@mpeg4-2.mp4", NSTemporaryDirectory()]; NSFileManager *fileManager = [NSFileManager defaultManager]; AVAsset *firstAsset = [AVAsset assetWithURL:[NSURL fileURLWithPath:firstassetpath]]; AVAsset *secondAsset =

AVPlayer with one video tracks and multiples audio tracks

老子叫甜甜 提交于 2019-12-10 20:27:54
问题 I'm trying to make a player in my App capable to have one video tracks and multiples audio tracks (for differents languages). I've done this but the player won't launch : AVMutableComposition *composition = [AVMutableComposition composition]; AVURLAsset* videoAsset = [[AVURLAsset alloc]initWithURL:urlVideo options:nil]; AVMutableCompositionTrack *compositionVideoTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; NSError* error =

precise timing with AVMutableComposition

你说的曾经没有我的故事 提交于 2019-12-07 03:01:18
问题 I'm trying to use AVMutableComposition to play a sequence of sound files at precise times. When the view loads, I create the composition with the intent of playing 4 sounds evenly spaced over 1 second. It shouldn't matter how long or short the sounds are, I just want to fire them at exactly 0, 0.25, 0.5 and 0.75 seconds: AVMutableComposition *composition = [[AVMutableComposition alloc] init]; NSDictionary *options = @{AVURLAssetPreferPreciseDurationAndTimingKey : @YES}; for (NSInteger i = 0;

Find assets in library - add to a AVMutableComposition - export = crash

寵の児 提交于 2019-12-06 16:22:10
I've been struggling with adding assets from the iPhone Photo Library to a AVMutableComposition and then export them. Here is what I got: Finding the assets: (here I grab the AVURLAsset) -(void) findAssets { ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; // Enumerate just the photos and videos group by using ALAssetsGroupSavedPhotos. [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { // Within the group enumeration block, filter to enumerate just videos. [group setAssetsFilter:[ALAssetsFilter allVideos]]; [group

iOS - AVAssestExportSession can only export maximum 8 tracks after playing with AVPlayer

这一生的挚爱 提交于 2019-12-06 08:33:53
问题 I'm trying to loop some fragments of a recorded video and merge them into one video. I've successfully merged and exported a composition with up to 16 tracks. But when I try to play the composition using AVPlayer before merging, I can only export a maximum of 8 tracks. First, I create AVComposition and AVVideoComposition +(void)previewUserClipDanceWithAudio:(NSURL*)videoURL audioURL:(NSURL*)audioFile loop:(NSArray*)loopTime slowMotion:(NSArray*)slowFactor showInViewController:

AVMutableComposition resizing issue

感情迁移 提交于 2019-12-05 13:52:07
问题 I'm trying to render an image into a video captured with the front camera using AVMutableComposition. The size of the resulting video (including the image) is perfectly fine. However, the initial video will be resized as shown in this picture: I'm using the NextLevelSessionExporter and this is my code snippet: // * MARK - Creating composition /// Create AVMutableComposition object. This object will hold the AVMutableCompositionTrack instances. let mainMutableComposition = AVMutableComposition

precise timing with AVMutableComposition

泄露秘密 提交于 2019-12-05 06:13:47
I'm trying to use AVMutableComposition to play a sequence of sound files at precise times. When the view loads, I create the composition with the intent of playing 4 sounds evenly spaced over 1 second. It shouldn't matter how long or short the sounds are, I just want to fire them at exactly 0, 0.25, 0.5 and 0.75 seconds: AVMutableComposition *composition = [[AVMutableComposition alloc] init]; NSDictionary *options = @{AVURLAssetPreferPreciseDurationAndTimingKey : @YES}; for (NSInteger i = 0; i < 4; i++) { AVMutableCompositionTrack* track = [composition addMutableTrackWithMediaType

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

AVMutableComposition resizing issue

时间秒杀一切 提交于 2019-12-04 00:57:53
I'm trying to render an image into a video captured with the front camera using AVMutableComposition. The size of the resulting video (including the image) is perfectly fine. However, the initial video will be resized as shown in this picture: I'm using the NextLevelSessionExporter and this is my code snippet: // * MARK - Creating composition /// Create AVMutableComposition object. This object will hold the AVMutableCompositionTrack instances. let mainMutableComposition = AVMutableComposition() /// Creating an empty video track let videoTrack = mainMutableComposition.addMutableTrack

How to set a transparent background for an AVVideoComposition?

喜夏-厌秋 提交于 2019-12-03 15:47:42
Update - I've added a 50 reputation bounty for answering this question! I have an application that needs to put together some videos and photos to create a movie out of them. I am using AVMutableComposition for that. To be able to instruct it how the videos get composed I have to use an AVMutableVideoComposition. This thing has a property called backgroundColor and Apple Documentation says: Only solid BGRA colors are supported; patterns and other supported colors are ignored. If the rendered pixel buffer does not have alpha, the alpha value of the background color is ignored. What I understand