dank074 / Discord-video-stream

Experiment for making video streaming work for discord selfbots.
185 stars 36 forks source link

Audio frametime, need to long. #122

Open Blendi87 opened 4 days ago

Blendi87 commented 4 days ago

After a good 5 minutes of playing, I get more and more of these error messages about the audio until the bot restarts. i mostly play .mkv files.

WARN stream:audio:send Frame takes too long to send (118.50% frametime) { WARN stream:audio:send "frame_size": 164, WARN stream:audio:send "duration": 23.699765000026673, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +0ms WARN stream:audio:send Frame takes too long to send (155.25% frametime) { WARN stream:audio:send "frame_size": 159, WARN stream:audio:send "duration": 31.0492090000771, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +26s WARN stream:audio:send Frame takes too long to send (131.29% frametime) { WARN stream:audio:send "frame_size": 172, WARN stream:audio:send "duration": 26.25833599991165, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +35s WARN stream:audio:send Frame takes too long to send (258.26% frametime) { WARN stream:audio:send "frame_size": 182, WARN stream:audio:send "duration": 51.651254999917, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +3s WARN stream:audio:send Frame takes too long to send (117.26% frametime) { WARN stream:audio:send "frame_size": 157, WARN stream:audio:send "duration": 23.451699999859557, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +135ms WARN stream:audio:send Frame takes too long to send (417.09% frametime) { WARN stream:audio:send "frame_size": 165, WARN stream:audio:send "duration": 83.41887400019914, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +2s

and so on

WARN stream:audio:send Frame takes too long to send (660.03% frametime) { WARN stream:audio:send "frame_size": 180, WARN stream:audio:send "duration": 132.00662300002296, WARN stream:audio:send "frametime": 20 WARN stream:audio:send } +575ms

I think the audio is trying to stay in sync with the picture and it's getting worse and worse.

Whether “minimizeLatency” is on or off doesn't matter.

I am using the latest version "4.1.2".

longnguyen2004 commented 4 days ago

Weird that it's only happening on audio and not video... Anyway, that warning message isn't related to syncing, it's measuring the actual time to send the audio frame. What is your system specs?

Blendi87 commented 4 days ago

intel n100 on Docker with 32gb ram for 480p .mkv files on a nvme.

it's just really noticeable that only the sound is affected and not the picture (the picture looks good).

btw. any chance of intel quick sync support? :)

longnguyen2004 commented 3 days ago

N100 has AES-NI, it shouldn't be struggling like that, weird. Anyway you can try setting forceChacha20Encryption to true, this will force the use of a faster encryption algorithm.

About Quick Sync, this library doesn't care about the specific encoder. You can copy the streamLivestreamVideo function and modify that to your likings. However, we expect the media stream to satisfy some conditions:

I'm currently working on a new API that should make this easier to do without leaking too much internal workings of the library out to user code.