Loukious / TikTokStreamKeyGenerator

TikTok Live Stream Key Generator for OBS Studio
113 stars 39 forks source link

Dynamic URL fetcher not using server with the lowest latency #18

Closed nguyenle2457 closed 4 months ago

nguyenle2457 commented 4 months ago

I noticed that you'd found a much cleaner way to grab the base server URL, however it's probably not performing as well as expected. With the hardcoded Server 1, this is the latency report:

image

I borrowed getServerUrl so I could then print it to console and perform a ping test on the resulted URL:

image

As you can see, the latency is much better using the previously hardcoded URL. Both originate in the same country, but one is closer to my location than the other.

Last night, I tried streaming and the live went down after 10 minutes because the room got forcefully closed due to a connection error. One quick Google search and I found out that even people who use the official Live Studio program have the same issue. It led me to thinking that TikTok isn't being very smart with its server selection algorithm and thus, horrible streaming performance, I can't be sure. In any case, I doubt there's much you can do since you're just querying the new URL for the streaming URL.

As it stands, I was hoping you would consider a built-in latency indicator, as well as an option to fallback to another server (e.g one of the hardcoded ones).

Loukious commented 4 months ago

Can you try pinging the rtmp server instead?

nguyenle2457 commented 4 months ago

Looks like I made a mistake similar to the last time, not thinking about pinging the rtmp server. The ping is fine, though unlike the speedtest available in Live Studio, I cannot be sure of the upload throughput to the selected server. Doesn't bode well for me in any case, guess I'll chalk it up to bad internet connection. I would ask you to find out how TikTok is terminating (not due to any guideline violation, mind you) the livestream on their end and possibly implement mitigation, but that would require you to somehow replicate that.

Loukious commented 4 months ago

Looks like I made a mistake similar to the last time, not thinking about pinging the rtmp server. The ping is fine, though unlike the speedtest available in Live Studio, I cannot be sure of the upload throughput to the selected server. Doesn't bode well for me in any case, guess I'll chalk it up to bad internet connection. I would ask you to find out how TikTok is terminating (not due to any guideline violation, mind you) the livestream on their end and possibly implement mitigation, but that would require you to somehow replicate that.

They could be ending it because you're sending higher bitrate than you should.

nguyenle2457 commented 4 months ago

I wasn't. I use 10,000 CBR, which is the max seen in Live Studio. The issue is very consistent in that it ends the live at the 10 minute mark. Prior to that, everything was fine. And as I've said, a lot of people on reddit have experienced the same issue using the official program. P/S: Honestly, livestreaming on TikTok has been quite a bad experience. You can close this issue because I don't think your program has to do with any of this.

Loukious commented 4 months ago

I wasn't. I use 10,000 CBR, which is the max seen in Live Studio. The issue is very consistent in that it ends the live at the 10 minute mark. Prior to that, everything was fine. And as I've said, a lot of people on reddit have experienced the same issue using the official program. P/S: Honestly, livestreaming on TikTok has been quite a bad experience. You can close this issue because I don't think your program has to do with any of this.

Just tested it and it seems to be working fine. Though the mobile camera stream spoofing seems to have similar issue to the one you're describing. You're not using spoofing, are you?

Loukious commented 4 months ago

Seems like I fixed the camera stream spoofing issue. You might wanna try TikTok live studio to see if you have the same issue or not and make new post here.

nguyenle2457 commented 4 months ago

My account doesn't have mobile live access, only Live Studio access because apparently applying via their form doesn't mean access to Live in general I guess. Even so, it's great that you fixed it for those who do use mobile spoofing. Anyway, I've concluded that my ISP has severe routing issues to the server(s) nominated by TikTok. Using Live Studio's connection test, I would often times get unusable upload speed + crazy high latency or straight up timed out. Split tunneling OBS through a VPN is the workaround for now. My only real gripe is how TikTok forcefully terminates your live room, unlike other platforms (i.e YouTube, Twitch) where the worst that could happen is having dropped frames in OBS. With this app, since each room uses a different key, you'd have to open a new one then re-enter them.