SuRGeoNix / Flyleaf

Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
GNU Lesser General Public License v3.0
723 stars 103 forks source link

Play/Merge multiple audio streams with a single player #408

Open Lizhengbo0304 opened 10 months ago

Lizhengbo0304 commented 10 months ago

I have a video file without audio and I want to pass public DecoderContext.ExternalStreamOpenedArgs Open(ExternalStream extStream,bool resync = true,bool defaultAudio = true,int streamIndex = -1); method adds ExternalAudioStream for synchronous playback. I found that when I added multiple ExternalAudioStreams, the last one always took effect, and there was no expected effect of all AudioStreams playing at the same time. I would like to ask if there is any way to add multiple ExternalAudioStreams at the same time and take effect at the same time

SuRGeoNix commented 10 months ago

Hi @Lizhengbo0304, if your question is 'Can Flyleaf play more than one audio streams at the same time?' then the answer is 'No'. I would be interesting in your case as I'm planning to support this in v4. I remember someone in the past, wanted to play desktop sound and microphone at the same time for example. You might be able to achieve this by using two players but you will need to handle the resync between them.

Lizhengbo0304 commented 10 months ago

@SuRGeoNix Thank you very much for your response. Since I have quite a few audio files to play, creating multiple players just for the sake of playing sound seems resource-intensive to me. For now, I've temporarily used FFMPEG to merge all the audio files into one and then play it using Open(ExternalStream extStream,bool resync = true,bool defaultAudio = true,int streamIndex = -1); method, which achieves my goal. Looking forward to the V4 version.