Questions tagged [avcomposition]
72 questions
5
votes
2 answers
Compositing 2 videos on top of each other with alpha
AVFoundation allows you to "compose" 2 assets (2 videos) as 2 "tracks", just like in Final Cut Pro, for example.
The theory says I can have 2 videos on top of each other, with alpha, and see both.
Either I'm doing something wrong, or there's a bug…

StuFF mc
- 4,137
- 2
- 33
- 32
5
votes
1 answer
How to set a transparent background for an AVVideoComposition?
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…

Mihai Fratu
- 7,579
- 2
- 37
- 63
5
votes
1 answer
AVAssetImageGenerator random failings in iOS7
I have an AVComposition and a AVVideoComposition that I generate thumbs for every half second or so of the video. I use the animation tool for some overlays. I execute the call on an operation Queue and it triggers after certain types of edits. …

JADurham909
- 221
- 2
- 7
4
votes
1 answer
Failed to initialize an AVAssetExportSession (iPhone XS, XR, XMax)
When I instantiate an AVAssetExportSession object in new simulators instance with either of the 2 methods:
AVAsset *videoAsset = [AVAsset assetWithURL:videoURL];
AVAssetExportSession *exporter = [AVAssetExportSession exportSessionWithAsset:asset…

Sterling
- 161
- 9
3
votes
1 answer
How to merge video and audio files?
My question is: How to merge video and audio files that has almost the same duration?
I searched and got some answers to this question. However when I try the code they gave, it just does not produce a "non-zero byte" movie.
Could you take a look at…

user1192409
- 46
- 4
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
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
1 answer
Mute Video + Transform Video Using single export operation of AVAssetExportSession
I have following code to fix Tranform of video
- (AVVideoComposition *)squareVideoCompositionFor:(AVAsset *)asset {
AVAssetTrack *track = [asset tracksWithMediaType:AVMediaTypeVideo].firstObject;
CGFloat length =…

Prashant Tukadiya
- 15,838
- 4
- 62
- 98
3
votes
1 answer
Merge multiple videos from directory
I have requirement that load all videos from document directory and then merge into single video.And then upload video on server. But this code only merge two videos. How i can merge multiple videos.
func mergeVideo(index:Int){
…

Shahbaz Akram
- 1,598
- 3
- 28
- 45
3
votes
2 answers
iOS - AVAssestExportSession can only export maximum 8 tracks after playing with AVPlayer
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…

Pham Minh Tri
- 41
- 1
- 4
3
votes
2 answers
iOS - how to play sound file using avfoundation
I want to play a sound file (which I have dragged into xcode and copy to the project) using av foundation with the following code but fail.
I think NSURL *url = [[NSURL alloc] initWithString:@"sound.caf"]; this is where it goes wrong, but I have no…

Newbie
- 2,775
- 6
- 33
- 40
3
votes
1 answer
iOS: Draw on top of AV video, then save the drawing in the video file
I'm working on an iPad app that records and plays videos using AVFoundation classes. I have all of the code for basic record/playback in place and now I would like to add a feature that allows the user to draw and make annotations on the…

mpemburn
- 2,776
- 1
- 35
- 41
2
votes
0 answers
Crop Horizontal Video Into Vertical Based On Face Locations
For some reason, the export session always fails when I add the 'faceTrackInstructions' to the composition. Everything else works fine when I don't include the instruction however, the vertical crop is centred in the horizontal video. I want the…

John
- 21
- 1
2
votes
1 answer
Transform wrong when using both AVComposition and AVVideoComposition
I am creating an AVMutableComposition. I need the asset to be flipped horizontally, so I am setting the transform of the composition track like this:
compositionTrack.preferredTransform = assetTrack.preferredTransform.scaledBy(x: -1, y: 1)
If…

Tometoyou
- 7,792
- 12
- 62
- 108
2
votes
1 answer
AVPlayer freezes when seeking between two videos of AVComposition
Me and my team have an issue that we can't fix for few weeks now.
When we seek forward between two videos in AVComposition - the preview freezes (AVPlayer with AVPlayerLayer used for playback). It gets stuck on last frame of first video. It doesn’t…

Oleksii Nezhyborets
- 911
- 11
- 23