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 AVPlayer
s 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 AVMutableCompositionTrack
s. 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.
精彩评论