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
3
votes
1 answer

AVPlayer with one video tracks and multiples audio tracks

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…
mat250
  • 31
  • 1
  • 2
3
votes
1 answer

Trouble applying scaleTimeRange on multiple videos in a AVMutableComposition video

I am attempting to merge videos with scaleTimeRanges (to make them slo-mo or speed-up); however, it is not working as desired. Only the first video has the timerange effect... not all of them. The work is done in the merge videos function; it is…
NCT 127
  • 596
  • 1
  • 6
  • 27
3
votes
1 answer

What is the best way to draw custom timestamp text over a video with AVFoundation?

I've got an AVMutableVideoComposition that I'm exporting with AVAssetExportSession and I'm trying to overlay a custom timestamp that updates every second on top of it. Should I be using AVAssetWriter, multiple CALayers with CABasicAnimations, or…
3
votes
1 answer

Swift: Adding Audio to AVMutableComposition

I'm using the code in the answer to the question posted here (added below): Swift 3: How to add watermark on video ? AVVideoCompositionCoreAnimationTool iOS 10 issue The code strips the video track from a recorded video and adds a watermark. The…
Gene M.
  • 130
  • 9
3
votes
2 answers

Difficulty Merging Two Videos Using AVMutableComposition

I am working on a project wherein I am trying to merge two AVAssets (video files) together using an AVMutableComposition. My video files, when saved to my Camera Roll, are both exactly as expected. Their URL is valid, but yet my final exported…
ZbadhabitZ
  • 2,753
  • 1
  • 25
  • 45
3
votes
3 answers

Composing Video and Audio - Video's audio is gone

My question is, I am using the function below, to compose a video and audio. I want to keep video's original sound but it goes away somehow, I do not have any clue. I got this function from this answer I tried to change volumes right after…
Faruk
  • 2,269
  • 31
  • 42
3
votes
1 answer

AVMutableComposition somehow exports portrait video to landscape orientation

This function is exporting the merged composition to a landscape orientation when the source video is in portrait. I save the original video in portrait orientation to my documents directory and then save it to camera roll and works fine. I then…
Randall Ridley
  • 363
  • 3
  • 13
3
votes
0 answers

Merging two clips with different orientations using AVMutableCompasition / AVFoundation

How can I merge two clips with different orientations using an AVMutableCompasition and AVAssetTracks? It works when the orientations are correct, but if I use something like a Square cropped video the export just fails with an "Unknown Error".
aroooo
  • 4,726
  • 8
  • 47
  • 81
3
votes
1 answer

ScaleTimeRange of only a part of video

The scaleTimeRange(timeRange: CMTimeRange, toDuration duration: CMTime) method works very well if one wants to apply Slow motion effect to video. But I noticed that it only works if applied to the entire video's duration. If an arbitrary timeRange,…
user7404038
3
votes
1 answer

iOS AVMutableComposition Add text overlay

can someone please advise. I am trying to add a text overlay (title) to a video I am composing using AVFoundation. I found a few online resources (see…
3
votes
0 answers

iOS how to insert background for an existing video

I need to make a background for an existing video. The background should be a pre-provided image (png type). Summary, I have an existing video and an existing image. How can I make the image as the background for the video? I need exactly that…
vietstone
  • 8,784
  • 16
  • 52
  • 79
3
votes
0 answers

Why is my video rotating when I add a watermark?

I am cropping a video using AVAssetExportSession and having no problems: func cropVideo() { let videoAsset = AVAsset(URL: recordedVideoURL) let mixComposition = AVMutableComposition() do { let videoTrack =…
swiftyboi
  • 2,965
  • 4
  • 25
  • 52
3
votes
2 answers

iOS merge (mix) 2 or more audio files to wav format

I've created method below for merge (join, union, I am not sure which is right word for this, I want to make 1 audio from 2 or more and not one after each other but to play each at once). As inputs I have multiple audio files in .wav format and I…
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
3
votes
1 answer

Weird AVMutableComposition behavior when headphones are plugged in

I have an app that streams mov files. One of the features in my app is recording audio over these streamed files. In order to accomplish that I download the streamed file in the background and then commence audio recording to capture user audio.…
hanleyhansen
  • 6,304
  • 8
  • 37
  • 73
3
votes
1 answer

AVMutableComposition - Only Playing First Track (Swift)

I have an array of [AVAsset], and I am trying to combine all of those Assets into a single Asset so that I can play back the video seamlessly (I tried using an AVQueuePlayer, but that does not play back the assets seamlessly). Below is what I have…
sean
  • 3,484
  • 5
  • 27
  • 45