2

I am using the following gstreamer pipeline to grab RTMP src and transcode it with opusenc encoder and sending it as rtp packet to Mediasoup (a webrtc library).

gst-launch-1.0 \
  -v \
  rtpbin name=rtpbin rtp-profile=avpf do-retransmission=true \
  rtmpsrc location=rtmp://3.126.121.45:1935/live/qonda-injecttest-orig \
  ! flvdemux name=demux \
  demux.audio \
  ! queue \
  ! decodebin \
  ! "audio/x-raw,channels=2,rate=48000" \
  ! audioconvert \
  ! opusenc \
  ! rtpopuspay pt=101 ssrc=11111111 \
  ! rtpbin.send_rtp_sink_1 \
  rtpbin.send_rtp_src_1 ! udpsink host="3.69.236.199" port="41269" sync=true \
  rtpbin.send_rtcp_src_1 ! udpsink host="3.69.236.199" port="48143" sync=false async=false

But this produces very choppy/distorted audio. A sample here.

What am I doing wrong here?

HM Moniruzzaman
  • 135
  • 1
  • 11

2 Answers2

2

Found a solution that solves the problem. So Answering my own question.

I think it's more related to mediasoup (WebRTC framework that I am using) which uses OPUS which is set to channels=2 & rate=48000 but opusenc in gstreamer can use channels 1 or 8. Setting a sample rate of 24000 solves the problem.

Just need to add the following line before opusenc:

! audioresample ! audio/x-raw, rate=24000 
HM Moniruzzaman
  • 135
  • 1
  • 11
0

Sounds like a stereo audio interlacing problem, where every other sample is being skipped. Your provided output sample is a stereo MP3, yet both channels are identical.

Try using channels=1 or playing with or removing demux processing.

anthumchris
  • 8,245
  • 2
  • 28
  • 53