interleaving 4 channels of audio into vorbisenc or opusenc in gstreamer

安稳与你 提交于 2020-05-17 04:14:27

问题


I’m trying to interleave 4 channels of audio into one audio file

I have managed to successfully save them into wav with wavenc

gst-launch-1.0 interleave name=i filesrc location=FourMICS_RR_long.wav ! 
decodebin ! audioconvert ! audio/x-raw,format=(string)F32LE ! queue ! i.sink_0 
filesrc location=FourMICS_CR_long.wav ! decodebin ! audioconvert !   
audio/x-raw,format=(string)F32LE ! queue ! i.sink_1 
filesrc location=FourMICS_CL_long.wav ! decodebin ! audioconvert ! audio/x-raw,format=(string)F32LE  ! queue ! i.sink_2 
filesrc location=FourMICS_LL_long.wav ! decodebin ! audioconvert !  audio/x-raw,format=(string)F32LE ! queue ! i.sink_3 
i.src ! queue ! audio/x-raw,rate=48000,channels=4,format=F32LE,layout=interleaved ! queue ! 
wavenc ! queue ! filesink location=out2.wav

but when I save it as vorbisenc oggmux

gst-launch-1.0 interleave name=i filesrc location=FourMICS_RR_long.wav ! decodebin ! audioconvert !  audio/x-raw,format=(string)F32LE  ! queue ! i.sink_0
filesrc location=FourMICS_CR_long.wav ! decodebin ! audioconvert !  audio/x-raw,format=(string)F32LE ! queue ! i.sink_1 
filesrc location=FourMICS_CL_long.wav ! decodebin  ! audioconvert ! audio/x-raw,format=(string)F32LE  ! queue ! i.sink_2 
filesrc location=FourMICS_LL_long.wav ! decodebin  ! audioconvert !  audio/x-raw,format=(string)F32LE ! queue ! i.sink_3 
i.src ! queue ! audio/x-raw,rate=48000,channels=4,format=F32LE,layout=interleaved ! queue ! 
wavenc ! queue ! wavparse ! audioconvert  ! audio/x-raw,rate=48000,channels=4,format=F32LE,layout=interleaved !  
vorbisenc !  oggmux ! filesink location=out2.ogg

the channels get completely messed up when I play the file, or look at it in audacity.

I have also tried using

channel-positions=GST_AUDIO_CHANNEL_POSITION_REAR_LEFT

channel-mask=(bitmask)0x4

for each channel like this>

gst-launch-1.0 interleave name=i filesrc location=FourMICS_RR_long.wav !    decodebin ! audioconvert ! audio/x-raw,format=(string)F32LE,channel-position=GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,channel-mask=(bitmask)0x1   ! queue ! i. 
filesrc location=FourMICS_CR_long.wav ! decodebin ! audioconvert !  audio/x-raw,format=(string)F32LE,channels=(int)1,channel-position=GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,channel-mask=(bitmask)0x2  ! queue ! i. 
filesrc location=FourMICS_CL_long.wav ! decodebin  ! audioconvert ! audio/x-raw,format=(string)F32LE,channels=(int)1,channel-position=GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,channel-mask=(bitmask)0x3  ! queue ! i. 
filesrc location=FourMICS_LL_long.wav ! decodebin  ! audioconvert !  audio/x-raw,format=(string)F32LE,channels=(int)1,channel-position=GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,channel-mask=(bitmask)0x4 ! queue ! i. 
i.src ! queue ! audio/x-raw,rate=48000,channels=4,format=F32LE,layout=interleaved ! queue ! 
wavenc ! queue ! wavparse ! audioconvert  ! audio/x-raw,rate=48000,channels=4,format=F32LE,layout=interleaved !  
vorbisenc !  oggmux ! filesink location=out2.ogg

Same problem

Any suggestion as of how to solve this? I am not restricted only to vorbis, in fact I have similar issues also with opusenc.

Thanks.

Mar


回答1:


So. I got it working,

gst-launch-1.0 interleave name=i filesrc location=FourMICS_RR_long.wav ! decodebin ! audioconvert ! audioresample ! audio/x-raw,rate=24000,format=F32LE ! queue ! i.sink_0 
filesrc location=FourMICS_CR_long.wav ! decodebin ! audioconvert ! audioresample ! audio/x-raw,channels=(int)1,rate=24000,format=F32LE ! queue ! i.sink_1 
filesrc location=FourMICS_CL_long.wav ! decodebin  ! audioconvert ! audioresample ! audio/x-raw,channels=(int)1,rate=24000,format=F32LE ! queue ! i.sink_2 
filesrc location=FourMICS_LL_long.wav ! decodebin  ! audioconvert !  audioresample ! audio/x-raw,channels=(int)1,rate=24000,format=F32LE ! queue ! i.sink_3 
i.src ! capssetter caps=audio/x-raw,channels=4,channel-mask=(bitmask)0x33 ! audioconvert ! audioresample ! vorbisenc ! oggmux ! filesink location=out2.ogg

There were two issues 1. that the caps need to be set to the interleave 2. vorbisenc bitrate could not bare with 4 channels at 48khz



来源:https://stackoverflow.com/questions/37287949/interleaving-4-channels-of-audio-into-vorbisenc-or-opusenc-in-gstreamer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!