Hi,
I have a situation where I need to encode up to 8 independent mono tracks like what you would see on an audio mixing board. I created a proof of concept pipeline below to see if it can be done using a wave file with 8 channels. My trouble is that that the encoder always maps the channels to 7.1. I can’t seem to force the fourth channel (LFE) to play a full range of audio. I’m currently using AAC to encode, if there is a better encoder for this purpose I’d really like to know.
Is there a way to get around the LFE channel? Is there a way to force all channels to be mono?
Server stream pipeline
gst-launch-1.0 filesrc location=“8Channels.wav” ! wavparse ! audioconvert ! audio/x-raw,channels=8,layout=interleaved ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! mpegtsmux alignment=7 name=muxer ! srtsink uri=srt://:9001?mode=listener latency=0 wait-for-connection=false
Test stream pipeline (channel 4)
gst-launch-1.0 srtsrc uri=srt://127.0.0.1:9001?mode=caller ! queue ! decodebin ! audioconvert ! audioresample ! audio/x-raw,channels=8 ! deinterleave name=d d.src_3 ! queue ! audioconvert ! audioresample ! autoaudiosink
You might be able to play the the channel-mask
in the audio caps to avoid the default positioning for 8 channel audio.
However you may need to mux (and encode) each audio stream separately.
I tried a couple of ways to mux each audio stream separately.
First attempt produced all the 8 channels with the same tone which was channel 1 from source file.
gst-launch-1.0 ^
filesrc location=“8Channels.wav” ! wavparse ! audioconvert ! audio/x-raw,channels=8,layout=interleaved ! deinterleave name=d ^
d.src_0 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_1 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_2 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_3 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_4 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_5 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_6 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
d.src_7 ! audioconvert ! audio/x-raw,channels=1 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
mpegtsmux alignment=7 name=muxer ! srtsink uri=srt://:9001?mode=listener latency=0 wait-for-connection=false
Second I tried to use the audiomixer element but the output of each channel was garbled but was similar to the original pipeline.
gst-launch-1.0 ^
filesrc location=“8Channels.wav” ! wavparse ! audioconvert ! audio/x-raw,channels=8,layout=interleaved ! deinterleave name=d ^
d.src_0 ! audioconvert ! queue ! mixer.sink_0 ^
d.src_1 ! audioconvert ! queue ! mixer.sink_1 ^
d.src_2 ! audioconvert ! queue ! mixer.sink_2 ^
d.src_3 ! audioconvert ! queue ! mixer.sink_3 ^
d.src_4 ! audioconvert ! queue ! mixer.sink_4 ^
d.src_5 ! audioconvert ! queue ! mixer.sink_5 ^
d.src_6 ! audioconvert ! queue ! mixer.sink_6 ^
d.src_7 ! audioconvert ! queue ! mixer.sink_7 ^
audiomixer name=mixer ! audioconvert ! audio/x-raw,channels=8 ! avenc_aac aac-ms=0 bitrate=44100 ! aacparse ! queue ! muxer. ^
mpegtsmux alignment=7 name=muxer ! srtsink uri=srt://:9001?mode=listener latency=0 wait-for-connection=false
Looking at these pipelines is there anything obvious that I’m doing wrong? Thanks for the comment.