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

Videos more cropped than photos on single-lens devices

I have an app that can take both photos and videos at a predetermined zoom amount. It does this by simply cropping and rescaling the raw photo/video output. To crop the photos, I just create a new view with the cropped dimensions and put the photo…
zakray
  • 135
  • 1
  • 8
0
votes
0 answers

Error: Invalid sample cursor, or sample out of range reported for iOS custom audio track

As long as I add the original audio track in the video, an error "Invalid sample cursor, or sample out of range" will be reported when exporting. var audioInputParams: [AVMutableAudioMixInputParameters] = [] for audioTrack in audioTracks { guard…
0
votes
0 answers

Cropping Video from scrollview swift

I would like to implement functionality like below. i have used scrollView and based on zoom scale I tried to crop video but didn’t able to get same result. Can any one help me with this? Link for the functioanlity which I want :…
0
votes
1 answer

Merging video with original orientation

I have a link I can DM for a minimum working example! Recording Videos For recording, the AVCaptureConnection for an AVCaptureSession, I set isVideoMirrored to true when using the front camera and false when using the back camera. All in portrait…
0
votes
0 answers

swift avplayer automaticallyWaitsToMinimizeStalling don't work with AVMutableComposition

I have tvOS app and i try to show video from internet. But i have problem with buffering. I simulate situation when my internet connection was lost or slow. In this case time keeps going but video freeze. I have next code: guard let urlToVideo =…
WizaXxX
  • 1
  • 1
0
votes
1 answer

AVMutableComposition goes silent every once in a while

I'm trying to create a an audio loop in Swift and it works very well 9/10 times. But then suddenly, the 10th time (or so) the insertTimeRange function seems to fail in some way. I can see that the player has the correct length, but instead of taking…
ejanson
  • 469
  • 8
  • 16
0
votes
0 answers

AVFoundationErrorDomain Code=-11829 "Cannot Open" | NSOSStatusErrorDomain Code=-12848 | NSLocalizedDescription=Cannot Open, NSError=0x60000121cdb0

I get this error when I record a video on my iPhone and then try to upload the file to my application and create an AVMutableComposition. It does not work both on my iPhone and the simulator. private func getVideo(from itemProvider: NSItemProvider,…
0
votes
1 answer

AVMutableComposition -How to Merge Multiple Audio Recordings with 1 Video Recording

I have several audio clips that I recorded with an AVAudioRecorder over a video. Using a AVMutableComposition I want to merge the audio assets with the video at the times the audio was recorded. For eg, the video is 1 minute long, I recorded 3 audio…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
0
votes
0 answers

how to get video and audio from MKV? (swift)

i want to convert MKV (Matroska) to MP4 in swift when i add a file with MKV format my code break in line 8 , what should i do to fix that? this is my code: let composition = AVMutableComposition() do { let sourceUrl…
Amin Rezaew
  • 298
  • 1
  • 14
0
votes
1 answer

Swift -AVMutableVideoCompositionLayerInstruction Misalignment when Merging Videos

I followed the Ray Wenderlich to merge videos. The finished result is 1 merged video where portrait videos are at the top of the screen and landscape videos are at the bottom of the screen. In the image below the portrait videos plays first and then…
0
votes
0 answers

AVMutableComposition has slightly different duration than saved m4a file when using AVAssetExportSession

I'm adding an an m4a audio file from the file system, loaded via an AVURLAsset, into an AVMutableComposition. If the loaded asset has a duration of 1s, adding it to the AVMutableComposition results in the composition also having a duration of 1s.…
0
votes
1 answer

How to combine (hstack) multiple videos side by side with AVMutableVideoComposition?

I'm trying to combine 3 videos into single video where videos are cropped and put side by side in hstack. Here is my current solution which puts only the first video 3 times (repeating) side by side. I can not figure out what am I doing…
0
votes
0 answers

How to trim out multiple time-points in an AVAsset (Swift)?

I am working on a video editor app, where based on some processing, I have an array of samples/time-points to remove from the video clip. For example, timePoints = [0 8.2 15.5 20.6...]. //seconds I would like to remove these specific frames from the…
0
votes
1 answer

How to play a 60fps video at half speed with Swift & AVMutableComposition and AVPlayer on MacOS

I am adding 60fps video files to an AVMutableComposition and I am wondering if its possible to play that composition back at half speed. This is where its adding to the video track do { try videoTrack?.insertTimeRange(CMTimeRangeMake(start:…
jodldoe
  • 67
  • 7
0
votes
2 answers

AVAssetExportSession.exportAsynchronously does not make progress

Extended AVMutableComposition so that it can be exported. However, even a 1-second video does not progress at all when export is performed. I tried to print out the progress, and found that it didn't make any progress at 0.0. What could be the…
kusumoto_teruya
  • 2,415
  • 4
  • 23
  • 38