将4个音频通道交错到gstreamer中的vorbisenc或opusenc

时间:2016-05-17 23:45:34

标签: gstreamer

我正在尝试将4个音频通道交错到一个音频文件

我已成功用wavenc

将它们保存到wav中
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

但当我将其保存为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

当我播放文件时,通道会完全混乱,或以大胆的形式看待它。

我也尝试过使用

channel-positions=GST_AUDIO_CHANNEL_POSITION_REAR_LEFT

channel-mask=(bitmask)0x4

对于每个频道,例如>

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

同样的问题

关于如何解决这个问题的任何建议? 我并不仅限于vorbis,事实上我也有与opusenc类似的问题。

感谢。

1 个答案:

答案 0 :(得分:0)

因此。我搞定了,

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

有两个问题 1.帽需要设置为交错 2. vorbisenc比特率无法在48khz下显示4个通道