ThibaultBee / StreamPack

SRT/RTMP/RTMPS live streaming libraries for Android
https://thibaultbee.github.io/StreamPack/index.html
Apache License 2.0
175 stars 67 forks source link

Bitrate spikes drastically at the 5-minute mark when streaming to a RTPM server. #64

Closed brauliolomeli closed 1 year ago

brauliolomeli commented 1 year ago

The bitrate spikes drastically right at the minute 5:00 when streaming to a RTPM server.

To Reproduce Steps to reproduce the behavior:

  1. Run the demo-camera app on an Android device.
  2. Go to settings and confirm that the video rate is set to 2 kb/s, select endpoint type "Stream to a remote RTPM device" and provide a RTPM server
  3. Start streaming
  4. For 5 minutes the bitrate stays at ~2000kb/s, but after that it spikes to higher values like 5000kb/s or even more causing the stream to look laggy.

Expected behavior Bitrate stays at 2000 kb/s for as long as the stream lasts.

ThibaultBee commented 1 year ago

Hi,

Thanks for reporting this issue.

I guess you are refering to the video bitrate. That is a strange issue, I don't see any reason yet why the encoder changed its capped bitrate.

How do you measure bitrate? What device do you use? Could you test on another device?

ThibaultBee commented 1 year ago

Hi, I just tested RTMP again. The bitrate is not really stable, I believe it is a side effect of a mechanism I implemented to synchronise audio and video frames. Could you test with https://github.com/ThibaultBee/StreamPack/suites/11275378563/artifacts/578139145?

brauliolomeli commented 1 year ago

thank you for taking a look at this @ThibaultBee

I used a ONEPLUS NORD N20 and a Samsung Galaxy s22, same result on both devices.

I was looking at the bitrate in my RTMP server, but looking at it now in the Android network inspector, the spike is not noticeable. It might be a backend problem. I'll test with the link you provided shortly and share my findings.

brauliolomeli commented 1 year ago

Same result using the APK provided above, that outbound network traffic is ~300KB/s but the video is coming out of my RTMP server at ~7000 kb/s. I'll close this issue now and keep looking in the backend. Thank you.