【问题标题】:Gstreamer duplicate 2channel audioGstreamer 复制 2 声道音频
【发布时间】:2020-09-14 12:44:49
【问题描述】:

我想使用 audiotestsrc 生成 2 个音调,然后将这两个通道复制到 16 个通道(即一个音调的 8 个通道和另一个音调的 8 个通道)。

我有一个为 2 个通道生成 2 个音调的命令:

gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav  audiotestsrc wave=0 freq=100 volume=0.4 ! decodebin ! audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x1" ! queue ! i.sink_0   audiotestsrc wave=1 freq=150 volume=0.4 ! decodebin ! audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x2" ! queue ! i.sink_1

我还有一个命令可以在 16 个通道中生成 1 个音调:

gst-launch-1.0 audiotestsrc wave=0 freq=100 volume=0.4 ! audio/x-raw,rate=48000,format=S16BE ! queue ! capssetter caps="audio/x-raw,channels=16,rate=48000,channel-mask=(bitmask)0xffff" ! audioconvert ! audioresample ! wavenc ! filesink location=test.wav

所以我的问题:

有没有办法将这两个命令结合起来? 我尝试了几个不同的选项并假设了一个位掩码 需要 0xaaaa 和 0x5555 来“映射”哪些通道获得哪些音调。

但我总是遇到语法错误或

WARNING: erroneous pipeline: could not link capssetter0 to i

WARNING: erroneous pipeline: could not link queue0 to i

我觉得我很接近但并不完全在那里。

任何帮助将不胜感激。

【问题讨论】:

    标签: audio gstreamer audio-streaming gstreamer-1.0


    【解决方案1】:

    看起来我找到了一个至少适用于偶数输出通道数的解决方案:

    gst-launch-1.0 interleave name=i audiotestsrc wave=0 freq=100 volume=0.4 ! decodebin ! audioconvert ! audio/x-raw,format=S16BE,channels=1,channel-mask=(bitmask)0x1 ! queue ! i.sink_0 audiotestsrc wave=2 freq=100 volume=0.4 ! decodebin ! audioconvert ! audio/x-raw,format=S16BE,channels=1,channel-mask=(bitmask)0x1 ! queue ! i.sink_1 i.src ! capssetter caps=audio/x-raw,format=S16BE,channels=6,channel-mask=(bitmask)0x3f ! audioconvert ! audioresample ! wavenc ! filesink location=test.wav
    
    

    所以下一个技巧是处理奇数输出通道数。即 5

    1. 我尝试将输出映射到 6 个通道,但使用了 channel-mask=0x1f。
    2. 还尝试将输出映射到 6 个通道,然后使用:
    ! audioconvert ! capssetter caps="audio/x-raw,format=S16BE,channels=5,channel-mask=(bitmask)0x1f" !
    

    这些都不起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-27
      • 1970-01-01
      • 1970-01-01
      • 2022-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多