Search code examples
audiogstreamerpipelinemu-law

Creating a mulaw audio file from L16


I have a wave file with these properties.

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

I want to make 2 pipelines

1) I am throwing this file contents as RTP packets on port=5000

2) listen to port=500 catch the rtp packets and make an audio file with following properties

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

What I have tried is: Sender:

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

Receiver:

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

But I am getting L16 file at the Test.ulaw and not PCMU

Any suggestion?


Solution

  • Inspect what the mulawdec element does:

    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 ]
    

    So basically it decodes Mu Law to PCM. If you want to save the raw Mu Law instead remove the mulawdec element.