Questions tagged [avmutablecomposition]

AVMutableComposition is a mutable subclass of AVComposition you use when you want to create a new composition from existing assets. You can add and remove tracks, and you can add, remove, and scale time ranges.

AVMutableComposition is a mutable subclass of AVComposition you use when you want to create a new composition from existing assets. You can add and remove tracks, and you can add, remove, and scale time ranges.

At its top-level, AVComposition is a collection of tracks, each presenting media of a specific media type, e.g. audio or video, according to a timeline. Each track is represented by an instance of AVCompositionTrack. Each track is comprised of an array of track segments, represented by instances of AVCompositionTrackSegment. Each segment presents a portion of the media data stored in a source container, specified by URL, a track identifier, and a time mapping. The URL specifies the source container, and the track identifier indicates the track of the source container to be presented.

Sources:

282 questions
39
votes
2 answers

AVFoundation + AssetWriter: Generate Movie With Images and Audio

I have to export a movie from my iPhone application which contains UIImage from an NSArray and add some audio files in .caf format that have to start at pre-specified times. Now I have been able to use the AVAssetWriter (after going through many…
MuTaTeD
  • 861
  • 2
  • 8
  • 13
18
votes
1 answer

Fixing orientation when stitching (merging) videos using AVMutableComposition

TLDR - SEE EDIT I am creating a test app in Swift where I want to stitch multiple videos together from my apps documents directory using AVMutableComposition. I have had success in doing this to some degree, all my videos are stitched together and…
AngryDuck
  • 4,358
  • 13
  • 57
  • 91
18
votes
6 answers

AVMutableVideoComposition rotated video captured in portrait mode

I have used below code to add image overlay over video and then export the new generated video to document directory. But strangely,video gets rotated by 90 degrees. - (void)buildTransitionComposition:(AVMutableComposition *)composition…
Dhruv
  • 2,153
  • 3
  • 21
  • 45
17
votes
4 answers

How to merge a *Single Image* with a video

I am trying to combine a single video with a single image. This is not trying to combine many images into a single video such as create movie from [UIImage], Swift How do I export UIImage array as a movie? Make movie file with picture Array and…
impression7vx
  • 1,728
  • 1
  • 20
  • 50
16
votes
2 answers

Only First Track Playing of AVMutableComposition()

New Edit Below I have already referenced AVMutableComposition - Only Playing First Track (Swift) but it is not providing the answer to what I am looking for. I have a AVMutableComposition(). I am trying to apply MULTIPLE AVCompositionTrack, of a…
impression7vx
  • 1,728
  • 1
  • 20
  • 50
15
votes
5 answers

AVAssetExportSession giving me a green border on right and bottom of output video

Here's the code: AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetHighestQuality]; exporter.outputURL = outputUrl; exporter.outputFileType =…
15
votes
1 answer

AVMutableComposition Video Creation Issue

I am creating video using AVMutableComposition and exporting it using AVAssetExportSession giving it preset AVAssetExportPresetHighestQuality. Video is created fine when video's dimension is small. But when video's dimension is large e.g.…
Unnati
  • 2,441
  • 17
  • 37
14
votes
3 answers

AVMutableComposition Rotates Videos

I've recently discovered an issue using AVMutableComposition and I'm looking for some insight into this. I want to be able to record video in two orientations - landscape left and right. When I record videos in landscape right (home button is on the…
anon_dev1234
  • 2,143
  • 1
  • 17
  • 33
13
votes
2 answers

How do I add a still image to an AVComposition?

I have an AVMutableComposition with a video track and I would like to add a still image into the video track, to be displayed for some given time. The still image is simply a PNG. I can load the image as an asset, but that’s about it, because the…
zoul
  • 102,279
  • 44
  • 260
  • 354
13
votes
1 answer

CABasicAnimation with zero duration

I have a CALayer in an AVMutableComposition that is faded in, should stay on screen for a while and then disappear. The problem is, it should disappear without an animation, but CABasicAnimation has a minimum duration of 0.25 seconds. How would can…
Swissdude
  • 3,486
  • 3
  • 35
  • 68
12
votes
2 answers

Transform not working in AVMutableVideoComposition while exporting

My goal is to compose a set of clips recorded from the camera and export them at a certain preferred size. Of course, the video orientation needs to be rotated before exporting. I'm doing this by composing an AVMutableComposition from an array of…
BooTooMany
  • 1,192
  • 12
  • 19
12
votes
4 answers

CATextLayer doesn't appear in an AVMutableComposition when running from a unit test

EDIT: The strangest thing: it seems that when running this code from a full app everything works, but I was always running the creation of the movie from my unit tests, and only there it didn't work. Trying to figure out why is that... I'm trying to…
yonix
  • 11,665
  • 7
  • 34
  • 52
11
votes
1 answer

What's causing AVMutableComposition to increase the size of video drastically? - iOS, Swift, AVFoundation

Assuming that we have two video assets (AVAsset objects), let's call them blank and main, where main is a video of random limited length, let's say 2-5 minutes, and blank is always a 4 second video, we want to merge the videos in the following…
Armin
  • 629
  • 6
  • 23
11
votes
1 answer

Nested AVMutableComposition

I'm trying to use AVMutableComposition in a nested hierarchy. Therefor I have to put a composition into an other composition. Doing so results into the following error message: AVCompositionTest[45347:10703] comp2 >>> The operation could not be…
Tobias Kräntzer
  • 1,694
  • 1
  • 13
  • 23
10
votes
3 answers

Black frames in AVMutableComposition

This question is quite related to AVMutableComposition - Blank/Black frame between videos assets but as I am not using an AVAssetExportSession the answers doesn't fit my problem. I'm using an AVMutableComposition to create a video composition and…
chub
  • 767
  • 6
  • 11
1
2 3
18 19