从 L16 创建 mulaw 音频文件

Creating a mulaw audio file from L16

我有一个具有这些属性的波形文件。

   sampling rate = 16000 Hz 
   encoding = L16 
   channels = 1 
   bit resolution = 16

我想制作 2 个管道

1) 我将此文件内容作为 RTP 数据包发送到 port=5000

2) listen to port=500 catch the rtp packets and make a audio file with 以下属性

   sampling rate = 8000 Hz 
   encoding = PCMU 
   channels = 1 
   bit resolution = 8

我试过的是: 发件人:

gst-launch-1.0 filesrc location=/path/to/test_l16.wav ! wavparse ! audioconvert ! audioresample ! mulawenc ! rtppcmupay ! udpsink host=192.168.xxx.xxx port=5000

接收者:

gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp,media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMU, channels=(int)1" ! rtppcmudepay ! mulawdec ! filesink location=/path/to/test_pcmu.ulaw

但我在 Test.ulaw 而不是 PCMU

获取 L16 文件

有什么建议吗?

检查 mulawdec 元素的作用:

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      audio/x-mulaw
                   rate: [ 8000, 192000 ]
               channels: [ 1, 2 ]

  SRC template: 'src'
    Availability: Always
    Capabilities:
      audio/x-raw
                 format: S16LE
                 layout: interleaved
                   rate: [ 8000, 192000 ]
               channels: [ 1, 2 ]

所以基本上它将 Mu Law 解码为 PCM。如果您想保存原始 Mu Law,请移除 mulawdec 元素。