# Trying to Understand Use of opusenc with Gstreamer

**URL:** <https://discourse.gstreamer.org/t/trying-to-understand-use-of-opusenc-with-gstreamer/648>\
**Category:** Application Development\
**Created:** [December 6, 2023, 7:47pm UTC](https://discourse.gstreamer.org/t/trying-to-understand-use-of-opusenc-with-gstreamer/648 "2023-12-06T19:47:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimruxton](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/jimruxton/32/140_2.png) [@jimruxton](https://discourse.gstreamer.org/u/jimruxton)\
**Post date:** [December 6, 2023, 7:47pm UTC](https://discourse.gstreamer.org/t/trying-to-understand-use-of-opusenc-with-gstreamer/648/1 "2023-12-06T19:47:33Z")

</div>

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=192.168.1.255 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.  
Jim

---

<div class="post-metadata">

**Author:** ![Joe](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@Joe](https://discourse.gstreamer.org/u/Joe)\
**Post date:** [December 6, 2023, 8:20pm UTC](https://discourse.gstreamer.org/t/trying-to-understand-use-of-opusenc-with-gstreamer/648/2 "2023-12-06T20:20:10Z")

</div>

Better to tell your OS and gstreamer version as well.

---

<div class="post-metadata">

**Author:** ![jimruxton](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/jimruxton/32/140_2.png) [@jimruxton](https://discourse.gstreamer.org/u/jimruxton)\
**Post date:** [December 6, 2023, 9:47pm UTC](https://discourse.gstreamer.org/t/trying-to-understand-use-of-opusenc-with-gstreamer/648/3 "2023-12-06T21:47:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ndufresne](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/ndufresne/32/10_2.png) [@ndufresne](https://discourse.gstreamer.org/u/ndufresne)\
**Post date:** [December 7, 2023, 3:30pm UTC](https://discourse.gstreamer.org/t/trying-to-understand-use-of-opusenc-with-gstreamer/648/4 "2023-12-07T15:30:13Z")

</div>

As shared previously over the mailing list, I [have a test](https://gitlab.collabora.com/nicolas/bitrate-monitor) to check the reaction of the encoders against their configured rate. Here’s the output for:

```auto
./bitrate-monitor.py --encoder opusenc test.png

```

![test](https://discourse.gstreamer.org/uploads/default/original/1X/a76dc659e321581334ae4b88ec5f58f1744de1f8.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:

```auto
  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).
