How to split a Raw Audio Buffer with 2 channels within frame into two different buffer

Hey team ! I'm trying to process an FLV stream with AAC codec for the audio, and the audio part has 2 channels that I would like to treat separately, is there a way to split my pipeline in order to handle the 2 channels differently? Here is an overview of the pipeline:
child(:source, %Membrane.RTMP.Source{
socket: socket
})
|> child(:demuxer, Membrane.FLV.Demuxer)
|> via_out(Pad.ref(:audio, 0))
|> child(:audio_parser, %Membrane.AAC.Parser{})
|> child(:audio_decoder, Membrane.AAC.FDK.Decoder)
|> child(:converter, %Membrane.FFmpeg.SWResample.Converter{
output_stream_format: %Membrane.RawAudio{
sample_format: :f32le,
sample_rate: 16_000,
channels: 2
}
})
child(:source, %Membrane.RTMP.Source{
socket: socket
})
|> child(:demuxer, Membrane.FLV.Demuxer)
|> via_out(Pad.ref(:audio, 0))
|> child(:audio_parser, %Membrane.AAC.Parser{})
|> child(:audio_decoder, Membrane.AAC.FDK.Decoder)
|> child(:converter, %Membrane.FFmpeg.SWResample.Converter{
output_stream_format: %Membrane.RawAudio{
sample_format: :f32le,
sample_rate: 16_000,
channels: 2
}
})
So I would like after that (or maybe the split should happen before the decoding and resampling), to have an element that provide 2 output with one channel each. Thanks ! 🙂
2 Replies
enzoqtvf
enzoqtvfOP•2w ago
Actually I managed to achieve it thanks to chatGPT 😄 I created an element that will split RawAudio payload, and it was easy because a stereo frame alternates between the left and right channel and the binary data is structured as L1,R1,L2,R2..., Ln,Rn
Sameer
Sameer•2w ago
Could you share what the pipeline looks like ? It will help anyone else who has a similar question in the future 🙂

Did you find this page helpful?