开发者

Fading in and out individual AVMutableCompositionTracks

开发者 https://www.devze.com 2023-02-13 15:56 出处:网络
I have multiple AVAssets, and I create individual AVMutableCompositionTracks for each. I then create an AVMutableComposition and add each AVMutableCompositionTrack to it and then create an AVAssetExpo

I have multiple AVAssets, and I create individual AVMutableCompositionTracks for each. I then create an AVMutableComposition and add each AVMutableCompositionTrack to it and then create an AVAssetExportSession, init with the AVMutableComposition and run the exporter. This allows me to create a single audio file made开发者_StackOverflow up of many overlapping audio sources.

I can trim and delay each source audio file by setting the parameters when I insertTimeRange on each AVMutableCompositionTrack. What I can't figure out is how to fade in and out of each individual track. I can do a master fade on the export session by using setVolumeRampFromStartVolume via AVMutableAudioMixInputParameters, and I know how to do fades on AVPlayers using the same method, but I don't think AVMutableAudioMixInputParameters can be used on an AVMutableCompositionTrack, right?

So how can I add a fade to a AVMutableCompositionTrack?

Thanks!


AVMutableAudioMixInputParameters actually can be used with AVMutableCompositionTracks. I use them. It just isn't stored within the composition. Instead, you'll need to set the audioMix property of any AVPlayer or AVAssetExportSession you use.

0

精彩评论

暂无评论...
验证码 换一张
取 消