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
0
votes
0 answers

AVMutableComposition not showing frames on simulator but works fine on device

Following is a simple two video merging code using AVFoundation's AVMutableComposition. I use two different mutable tracks for two videos and manage their layer opacity according to time: import UIKit import AVFoundation import AVKit class…
Rohan Sanap
  • 2,773
  • 2
  • 21
  • 39
0
votes
1 answer

Merge multiple video assets with correct orientation swift

I am simply trying to stitch together (merge) an array of videos (with correct original orientations), and it works HOWEVER with incorrect orientation of some videos. For example with the current preferredTransform, front facing videos are inverted…
user13255207
0
votes
1 answer

How to pass AVMutableComposition to AVAssetWriter

Right now I get a url from a AVMixComposition using AVExportSession. HighestQuality looks great but the file size is too big, a 15 sec video is 27 mb. MediumQuality looks horrible but the file size is only 1 mb. I know I have to use AVAssetWriter…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
0
votes
0 answers

Clips in AVMutableComposition have gap between them

I'm adding three clips to an AVMutableComposition like this... let asset = AVURLAsset(url: url, options: [ AVURLAssetPreferPreciseDurationAndTimingKey : true ]) let track = composition.addMutableTrack(withMediaType: .video, …
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
0
votes
1 answer

Do all following tracks need to be updated in a mutable composition if a track is removed?

To add a time range to an AVMutableCompositionTrack you have to specify the start time in the track (at:)... try track?.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: CMTime(seconds: 2,…
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
0
votes
2 answers

AVURLAsset returning empty array-Trying to Concatenate two files

I'm trying to concatenate two (multiple) audio files. I found a relevant post and solution at Concatenate Two Audio Files Swift Here's the solution: func mergeAudioFiles(audioFileUrls: NSArray) { let composition = AVMutableComposition() …
deafmutemagic
  • 123
  • 1
  • 7
0
votes
1 answer

Merging videos with AVMutableComposition

I am trying to merge two videos together using AVMutableComposition After scaling the video's i am not finding a way to crop the video or get rid of the part of the video that is marked red. I tried using setCropRect but to no use. Scaling and…
sarosh mirza
  • 702
  • 5
  • 12
0
votes
1 answer

Overlaying image on video reduces video resolution

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…
0
votes
1 answer

Issue while merging Video & Audio iOS swift4

2019-04-10 10:49:51.590008+0500 VTKaraokeView[869:1039603] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray' Hi iOS Gurus! I'm merging Video & Audio…
Ahtazaz
  • 903
  • 8
  • 21
0
votes
0 answers

iOS AVFoundation - video get zoomed after merging

I am working on merging the videos using avfoundation, merging works fine but videos get zoomed i think about 2x, after the merging is done. I also played single video clip after recording and it worked fine. Any help would be appreciated. You can…
Muneeb Jan
  • 45
  • 1
  • 7
0
votes
1 answer

how to merge video clips using avfoundation?

I have successfully merge the video clips to a single video but I am having a problem in the final merged video, the final video shows a white frame after the end of every video clip. I have tried a lot to remove this but couldn't find success.…
Muneeb Jan
  • 45
  • 1
  • 7
0
votes
0 answers

Mask Video Into Shape and Compose Over Another Video (AVComposition)

Perhaps I'm misunderstanding the capabilities of AVComposition, but I have a task that I am failing to know how to approach. I have a background video, which is a video of a tree; I also have a foreground video, which is a video of a horse; I have…
ZbadhabitZ
  • 2,753
  • 1
  • 25
  • 45
0
votes
1 answer

How to determine the end of all asynchronous calls from within a loop?

I have an app which combines multiple videos, the initial list of PHAssets are displayed and selected to form an array of PHAssets. Now on the screen which creates the video I need to loop through and fetch the AVAsset from the PHAsset. The issue I…
ORStudios
  • 3,157
  • 9
  • 41
  • 69
0
votes
0 answers

Adding Result of editing video in one output file to export swift

Hi i am developing a video editor , I want to understand how can i combine outputs of editing options like trimming , playback speed together in one output file to export edited video , for eg in trimming i export avasset whereas for speed I export…
0
votes
1 answer

How to merge mp4 and MOV type videos using AVMutableComposition iOS Swift?

I am using AVMutableComposition for merging videos, it's working fine when two videos are of same types like to mp4 videos or two mov videos. But if I try to merge one video of mp4 and one video of mov then merged video stopped after completion of…
user3202457
  • 135
  • 12