Screen sharing in Roblox

Hello! I’ve made screen sharing in roblox currently it is capped at 8 frames per second due to the http get limit but i will soon add chunking to increase that limit, and i also have to add more optimization, but i hope you enjoy it


78 Likes

You probably won’t be able to release this to the public, unless you lock it only to roblox or something, because people would probably use this to go to not very… appropriate… sites and share them.

19 Likes

only the person who is the game creator can use it as they have to run a python script

6 Likes

How did you make that because I wanna try and experiment with it.

3 Likes

my best guess is a python script uploading each pixel color to a website and then using http to get that info and change the color of parts or something that can display color

4 Likes

I dont think I can do that but I really wanna try it

1 Like

I used flask with ngrok, so it was free to host. It was a pretty fun project to do and i learned quite a bit of stuff

if you are ever going to do this, you should start off with one image and after that you can try real time screen sharing

Edit: I now use Playit.gg It is really really amazing and free with a domain that doesnt change each time if anyone wants to replicate this

4 Likes

I dont wanna create another topic so i’ll just comment it here
i’ve optimized it to the point that the max resolution is HD, you can change the resolution and fps in game without having to restart the server and i will be trying to add sound soon by getting audio volume and frequency

heres a lil clip to show it (fps is way lower as the resolution is about x2 higher but theres no lag on the roblox server)

9 Likes

wow that’s so cool, I know i am kinda late and i don’t know if you will respond, but i tried to do something like this and it works, hovewer the frame rate is a lot lower than yours. Did you use surfacegui and frames? Or is there any insance less laggy to achive better resolution. I also experienced lag in studio when moving the mouse over the screen.

1 Like

You should pre-record the frames instead of constantly sending it to the client/server. Look up ffpmpeg

2 Likes

I haven’t tested it myself but I got some information from a friend who created a similar thing, he said that parts were faster, but later on I looked on other things I could use like one sided plane which has 2 triangles instead of a cube (part) which has 12 triangles

Creating mesh parts is much more unoptimized than creating parts since you need to use :Clone() instead of Instance.new() which is a lot laggier due to it copying every single property

You should try experimenting with parts or GUI, make sure to turn off all features that are not needed like CanTouch,CanCollide,CastShadow,etc

I recommend using single sided planes which are 2 triangles due to it just having to render less triangles but other things might be better since i haven’t actually gone out of my way to do research on it besides words from others

3 Likes

this is real time, I’m not sure how I would pre-record real time frames and since this uses a HTTP request I have to send it from the server to the client since it would be a major security vulnerability on Roblox’s part to allow the client to send HTTP requests

1 Like

Yeah, I mean like recording the previous few frames or so every 5 seconds, etc then sending the pixel data back to Roblox.

Do you encode your data in Base64 or any other bytecode then decode it in Roblox?

1 Like

I already send frames in batches, the videos I displayed here did not have batched frames since they are old versions but as I stated at the very beginning I would be adding chunking to increase FPS which I have already done

Roblox uses Json with HTTP and Json formats all data in string so I dont see any reason I should encode it in Base64 (It would only increase data size), I have tried using compression methods such as Zlib but that takes too much time to decompress on Roblox’s side so that would just lower FPS

1 Like

Also I recommend using jimp

2 Likes

I do not use Javascript for this, I use python with either Opencv for video streaming or Pillow for screen sharing

Any image library will suffice for me since I am not limited by the python side of this but the Roblox side

1 Like

Wouldn’t it be funny if you screenshared this in front of players…

Sick programming though. Seems a lot like the Minecraft in Minecraft redstone stuff.

1 Like

Well i tried to use planes from mesh parts, and for some reason they only change color once and output says that color property doesn’t exist so the loop doesn’t work.

while RunService.Heartbeat:Wait() do
colors = GetPixels()
for c = 1, Sizex * Sizey do
pixels[c].BackgroundColor3 = Color3.fromRGB(tonumber(colors[c][1]), tonumber(colors[c][2]), tonumber(colors[c][3]))
end
end

try using pixels[c].Color instead

Releasing the game to the public would cause their account to get terminated lol

3 Likes