Hello all,
concerning this tutorial, use case 7, merging a background music
[Bitmovin Docs - Encoding Tutorials | Separating and Combining Audio Streams]
im having difficulties understanding if its possible to merge a mono audio from one input (let say my video file) with a stereo audio (let say file.mp3 or file.wav)
I have tried numerous attempts combining channels from both input files into an AudioMixInputStream or using one AudioMixInputStream for each file but without any success.
So I guess my question is how would one combine and adjust the gain of 2 input files of different audio configuration (mono and stereo) into one audio stream ?
Thanks
1 Like
Hi Mathieu,
the code sample “With volume adjustment” is already a good starting point.
It doesn’t matter which file(s) the source audio streams come from, as your create a separate IngestInputStream for each one.
If one of your inputs is mono and one is stereo, configure 3 AudioMixInputStreamSourceChannels accordingly: channel number 0 to select the left or mono, 1 to select the right.
To get a stereo output, create 2 AudioMixInputStreamChannels (again with channel numbers 0 and 1). Assuming that you want to mix the mono input over both channels of the stereo source, each of them will have 2 SourceChannelsItems.
Hope that helps
Hi Georg,
im not sure if I understand correctly but AudioMixInputStreamChannel takes only one IngestInputStream.
I tried creating 2 AudioMixInputStreamChannel per channel with each one referencing one IngestInputStream ( 1st input left + 2nd input left) and (1st input right + 2nd input right)
and passing these 4 AudioMixInputStreamChannel to the audioMix create.
But this is not working
Thanks for your help
AudioMixInputStreamChannel represents one output channel, so if you want stereo output you need no more than 2 in total.
For blending 2 inputs together, add two AudioMixInputStreamChannels to each of them (via addSourceChannelsItem()
)