Trying to Understand Use of opusenc with Gstreamer

I’m trying to stream audio to a device (ESP32) over wifi using opus encoding. It works however I would like to reduce the bitrate to try and get a greater distance over wifi. It appears that the bitrate variable for opusenc does nothing. I seem to get the same stream whether I put bitrate=2 or bitrate=32000. I’ve tried different bitrate types as well. Below is a typical pipeline that I’m using. I’m sending the stream to a broadcast over UDP

gst-launch-1.0 -v jackaudiosrc connect=0 ! audioconvert ! audioresample ! audio/x-raw, rate=8000 ! audioresample ! opusenc bitrate-type=cbr bitrate=32000 complexity=5 max-payload-size=1000 ! udpsink host= port=8000

What am I doing wrong? I am sending low frequency sounds so can tolerate low bitrates.

I don’t understand why if I set bitrate =0 I even get anything out of my decoder. I wouldn’t think it would work.
Thanks for any advice.

Better to tell your OS and gstreamer version as well.

Sorry , I am on Ubuntu 22.04 using “GStreamer Core Library version 1.20.3”

As shared previously over the mailing list, I have a test to check the reaction of the encoders against their configured rate. Here’s the output for:

./ --encoder opusenc test.png


Which show the encoder matching perfectly the selected rates. I think what may have happen if that you went out of range, and ended up thinking the rate controle does not work. gst-inspect-1.0 reports the following:

  bitrate             : Specify an encoding bit-rate (in bps).
                        flags: accès en lecture, accès en écriture, modifiable en l’état NULL, READY, PAUSED ou PLAYING
                        Integer. Range: 4000 - 650000 Default: 64000

So passing 2 was invalid, and should have yield a warning (with side effect of the the rate being ignored).

1 Like