StreamBot icon indicating copy to clipboard operation
StreamBot copied to clipboard

Delay/Lag When Streaming

Open myfirstevercode opened this issue 1 year ago • 13 comments

using the latest git clone version, i encounter a rendering issue i think. im using the same setup from the 1.1.5 version. on the latest clone, anything i play is laggy and out of sync. but when i revert to 1.1.5, everything is smooth for me.

myfirstevercode avatar Feb 20 '25 12:02 myfirstevercode

I don't have such an issue! Can you provide me with more details?

ysdragon avatar Feb 20 '25 18:02 ysdragon

Whenever im using the latest clone all of the account live stream are out of sync, like the voice are fine but the video are delayed, it is set as superfast/ultrafast, but when i switched back to the 1.1.5 version everything is on sync, both yt link and self host video, but ill try again to see if its the same

myfirstevercode avatar Feb 22 '25 04:02 myfirstevercode

But, I can't reproduce this issue. Can you try to remove the fps value and try again?

ysdragon avatar Feb 26 '25 02:02 ysdragon

@myfirstevercode Can you try with latest commit? e.g. run git pull and try again.

ysdragon avatar Feb 28 '25 11:02 ysdragon

Closed as no response.

ysdragon avatar Mar 22 '25 21:03 ysdragon

I'm having this same issue on the latest version with Twitch Streams. Tried lowering bitrate to as low at 750 but it made no difference.

DMCK96 avatar Apr 21 '25 11:04 DMCK96

@DMCK96 Does this only happen with Twitch streams?

ysdragon avatar Apr 22 '25 16:04 ysdragon

Yes, youtube appeared to be fine and used much less resources than Twitch with a similar length video.

When running the twitch video it was giving this in the log whilst near maxing out the CPU.

This is a cloud-dedicated server that I use for running ARK and Enshrouded servers (whilst using this bot those servers have not been running) so I wouldn't expect the server spec to be an issue.

  WARN stream:audio:send   "frame_size": 281,
  WARN stream:audio:send   "duration": 107.14336600000388,
  WARN stream:audio:send   "frametime": 20
  WARN stream:audio:send } +0ms
  WARN stream:audio:send  Frame takes too long to send (161.56% frametime) {
  WARN stream:audio:send   "frame_size": 276,
  WARN stream:audio:send   "duration": 32.31296100000327,
  WARN stream:audio:send   "frametime": 20
  WARN stream:audio:send } +3s
  WARN stream:video:send  Frame takes too long to send (167.30% frametime) {
  WARN stream:video:send   "frame_size": 1963,
  WARN stream:video:send   "duration": 110.41890899999999,
  WARN stream:video:send   "frametime": 66
  WARN stream:video:send } +0ms
  WARN stream:video:send  Frame takes too long to send (178.97% frametime) {
  WARN stream:video:send   "frame_size": 5747,
  WARN stream:video:send   "duration": 118.1189660000091,
  WARN stream:video:send   "frametime": 66
  WARN stream:video:send } +13s```

DMCK96 avatar Apr 22 '25 16:04 DMCK96

Same here. Try change codec to VP8, and lower bitrate. This is helping a little but now i have audio lag

gameboloto avatar May 09 '25 07:05 gameboloto

Used on a local computer (Gaming Specs) Starting a local video, Pixel quality sometime, lag spike, delay

  WARN stream:audio:send   "frame_size": 306,
  WARN stream:audio:send   "duration": 767.8950499999919,
  WARN stream:audio:send   "frametime": 20
  WARN stream:audio:send } +3s
  WARN stream:audio:send  Frame takes too long to send (2202.73% frametime) {
  WARN stream:audio:send   "frame_size": 316,
  WARN stream:audio:send   "duration": 440.5469709999743,
  WARN stream:audio:send   "frametime": 20
  WARN stream:audio:send } +2s  for local video

jonathann972 avatar Jun 17 '25 01:06 jonathann972

i have a similar project as of this, i recommend you using a nitro account for better streaming options and then you can use better bitrate. also to host a bot as of this you would need a good and powerful vps!!

parthcooks avatar Sep 23 '25 08:09 parthcooks

Used on a local computer (Gaming Specs) Starting a local video, Pixel quality sometime, lag spike, delay

  WARN stream:audio:send   "frame_size": 306,
  WARN stream:audio:send   "duration": 767.8950499999919,
  WARN stream:audio:send   "frametime": 20
  WARN stream:audio:send } +3s
  WARN stream:audio:send  Frame takes too long to send (2202.73% frametime) {
  WARN stream:audio:send   "frame_size": 316,
  WARN stream:audio:send   "duration": 440.5469709999743,
  WARN stream:audio:send   "frametime": 20
  WARN stream:audio:send } +2s  for local video

lag spike and pixel quality and delay are supposedly issues from discord bandwidth limits. this project needs optimisations for those, to temporarily fix these issues js use a nitro account(still could lag but would optimise it much better as dicord increases bandwidth for nitro accounts) only if audio is laggin behind and video is playing ; such issues are related to the specs and the machine.

parthcooks avatar Sep 23 '25 08:09 parthcooks

I think this issue is caused by the bun runtime, I'm running this bot at commit 47ed1ae9fb2eb865f372c6f91f187d91140e2f85 and using the nodejs runtime (node dist/index.js) and I don't have any frame or audio drop at all. In opposite when I'm using bun I'm having consistent frame drops ranging from 100ms to ~10s.

awakcon1234 avatar Sep 23 '25 10:09 awakcon1234