Stream From OBS To Another Computer on the Network Using UDP
Вставка
- Опубліковано 11 вер 2024
- 2021 UPDATE: To those of you watching this now, if you're trying to go from OBS on one system to OBS on another, look into NDI instead, it's lower latency and more reliable. If you're trying to do a hub-spoke model, follow through, but use RTSP or alternatively RTMP relays using Nginx, it should be more reliable.
In this video, I show you how you can configure OBS to stream to another computer on your local network using UDP. This could be used to relay a stream, or, simply to stream your display to another computer on your network.
If you liked this video, please leave a like and if you want more, then be sure to subscribe! If you didn't enjoy this video, then leave a comment stating why.
-Note-
Note that OBS adds a lot of latency as it also keeps a buffer. If you're not going to need to switch inputs, you can reduce latency by a fair bit by just using ffmpeg directly.
Music From:
EpidemicSound
-- Updated contact info --
Visit My Website: tonytascioglu.com
Questions? Comments? Email me at tonytash@pm.me
Now that I have played with this some more, OBS can't get to a much lower latency due to all the processing it does. I have been able to get latency down to ~0.1s by using FFMPEG to directly capture the screen, transcode to something like mjpeg, and then sent it over netcat. The client can then receive the signal, and play it directly using MPV or Mplayer, and disable the network cache to reduce the latency. Downside is you won't be able to easily switch inputs and stuff, but if all you want is to send a screen, it is much faster then the OBS solution. If enough people are interested I may showcase it.
Please do show it!
Maybe an explanation in the comments would be enough. I have buffer/latency atm ~4s which is way to large!
Please make a video about it!!
you all prolly dont care but does anyone know a way to log back into an instagram account..?
I stupidly forgot my login password. I would love any tricks you can offer me
@Koda Lyle instablaster =)
this is wonderful... much better than what i was searching for, great for learning OBS. thanks a lot...:)
I basically figured it out while going through the advanced menus learning OBS as well.
For more practical use, I think NDI has matured enough these days that if you're going OBS->OBS, it's almost guaranteed to be lower latency.
Also, if you're using this switching to RTSP or RTMP instead of UDP is a safe bet as well to get better reliability and use a more standard port.
I found a practical application for this. I have a church that wants to setup an overflow area for people to view the church service. they were streaming to facebook and then downloading the stream back into the overflow area, now they should be able to run their overflow even if their internet is completely down.
great idea sir
Could you do one with windows and vlc?
i'm not surprised that someone who would do such a nice video is also using linux :)
Thank you very much for the tutorial!
By the way I'm getting the cozy early UA-cam tutorial vibes from this video! Cheers!
Thanks, glad I could help!
Watching early tutorials definitely brings back nostalgia for me from when I started learning stuff off UA-cam...
great I was searching this for a long time!
Thank you for sharing this. Being able to have this level of control us ultra helpful.
Glad it was helpful!
Wow really enjoyed this. Thanks Tony!
Thanks Ali!
Not only I learned but you saved me a lot of time and effort cause now I can wifi monitor the external genarator that powers the ship im working w/o having the risk to make the travel there all the time :)
If it's a stable camera, you can also probably set up an RTSP stream, much lighter on the CPU as there is no compositing, etc. Most IP cameras already use RTSP, so you might not even need something like an RPi for encoding!
First, a question before anything else: *what software should I use to VIEW THIS STREAM ON A MOBILE ANDROID DEVICE* ? If anyone has an answer for this, PLEASE FEEL FREE TO POST IT WITHOUT READING ANYTHING ELSE. Again though, (WHAT SOFTWARE CAN/SHOULD I UsE TO VIEW THE STREAM ON MY MOBILE ANDROID DEVICE? *The MAIN USE CASE for me is to stream a Chrome window on my local network to a MOBILE ANDROID DEVICE*
Next, I just wanted to say: thank you SO MUCH! This is something I've been trying to do, as there are times where I want to stream to my phone stuff that is going on on my desktop, but things that I do not wish to broadcast over the internet for whatever reason (e.g. copyright reasons, test taking that I am proctoring, etc.). So, thank you VERY MUCH for your straightforward presentation for this.
I was looking for a way to stream, in network so that it did not broadcast over the internet, a variety of things, mainly desktop/browser/MS Word type stuff. Not really games or anything of that nature (although if I DO do games, it would be limited to very non-intensive games, such as FTL, Stardew Valley, etc. which are all indies with VERY modest requirements for them to be played, are not 3D, and stream easily enough.
Additionally, sometimes I have something going either in Chrome. For example, sometimes I proctor exams for people, and want to be able to keep an eye on their test taking while I step outside or away from the computer. Sometimes I've been "forced" to do it through twitch, and just make sure no one is coming into the channel while I'm there (it's a bit dishonest of me to stream someone while they're taking a test, because they may be embarrassed and not want others to see how they're doing, etc. These are not school exams either, but exams of a different kind, and I'll leave it at that). and if they do, I end the stream IMMEDIATELY, as again, I don't want to broadcast that to other people if I can help it (I ALWAYS have deleted the past broadcasts as well just to make sure no one can see them.
So, I've been looking for a way to stream stuff locally, just on my network, so that I can keep an eye on stuff from my phone, or a laptop, and am not forced to sit at my desktop, and this is exactly what I have been looking for to try and do. So, thank you for an easy to understand guide. I'm a bit more of an advanced user, and am pretty familiar with networking, but I just wanted to make sure I didn't need to do anything too crazy, other than pick the IP of the device I'm streaming to, and an unused port (thanks for suggesting 8081 by the way).
Now a question: Is there any problems using the built in NVIDIA encoding? I have a 1080, and prefer to offload it to the built in hardware encoding if possible. I do have a Ryzen 1700, so I have plenty of cores to play with though, so if it's better to use one of the one's you have recommended here, I will use those. "Better" could mean a few different things, but I mean a general '"better," regarding primarily speed, with clarity and image quality being second, since, regardless of which one I use, it's going to be high enough quality for my phone to see. I know everyone's phone is high def, and some people are obsessed with streaming even 4k (crazy, no?!?!) to their mobile devices, but at least in my opinion, 480p for my mobile phone is fine, as with the small screen size, the clarity (to me at least), is perfectly fine at 480p. I'll probably just keep using the nvecc encoder, if there's no problems there. Again, to be honest, this is mostly for me streaming desktop stuff as I said, so I can use either the nvecc encoder, OR, use something that utilizes a core, but if it ain't broke, don't fix it, and since nvecc has always worked well for me, no reason to switch. For stuff I've recorded where I cared a bit about the quality, I did do x264, because I BELIEVE (correct me if I'm wrong) that the quality of an x264 recording/stream is a bit higher than what the nvecc does, but, again, in this scenario, the device is going to be viewing (more than likely) in 480p, since the graphical fidelity in my opinion
Thanks to anyone who answers, and once again, thank you SO MUCH for making this simple walk through. I just wanted a straight forward answer regarding the networking aspects (where to find the networking settings, if I needed a special port, etc.), and you answered those questions quickly and straight forward. I watched the entire video to just make sure I understood everything, and to make sure you didn't include anything important, and/or complicated later in the video, and it seems pretty straight forward. Again, I was mainly interested in both the networking aspect, as well as *how to view it to the device I'm sending the data to* so thank you for everything again.
Sorry for the lengthy post, just wanted to 1) express my thanks to the author, 2) state the use case for me in case someone has some advice for me based on what I'll be using it for, and 3) ask WHAT SOFTWARE I SHOULD USE TO VIEW THIS STREAM ON A MOBILE ANDROID DEVICE and then 4) ask if the nvidia encoding is sufficient for my use case, or if its better to switch to something that's going to tax my CPU a little bit, which I don't mind as, again, it will not be utilized very much during the streaming, aside from Chrome and then later on perhaps some simple 2D games like Stardew Valley/FTL. Again though, the MAIN USE CASE is to STREAM A CHROME WINDOW ON MY LOCAL NETWORK TO A MOBILE ANDROID DEVICE.
And, once again, although I'm probably sounding like a broken record at this point: THANK YOU for this video, and thank you to anyone who has an answer for me or has any advice for me.
Much obliged,
KMAC
any media player would do , i use VLC and Mxplayer
Yo Tony, where'd you learn your theory on the variety of encoders and formats? I'm about to research it, and you seem to have wisdom, any book recommendations? (Curiosity for a Computer Engineer major)
Thanks, I was trying to do this for weeks, couldnt find anything on internet.
What if I am doing this from a Windows host & not linux?
Mostly the same. FFmpeg is cross-platform so it should still work. You may need to adjust the port you're using on Windows Firewall (on the receiving end) to allow the UDP packets.
how to do this with VLC media player (to show the stream, as windows does not have mpv)?
In my use case, I was looking for such a solution because I wanted to save some CPU and GPU resources from my main computer by allocating the generation of my streaming overlay to a second computer, because this overlay use a lots of javascript animation that is killing my main computer while playing, thank you :)
That moment you decided to use an old webcam as a security camera and want to be able to view it from the other side of the house wirelessly.
Try a SBC (cheapest Raspberry Pi for example), and use motion or ffmpeg to capture and stream it as mjpeg or h.264! It's less overhead, and the Raspberry Pi supports hardware acceleration for h264 encoding!
@@TonyTascioglu Thanks, I'll try it as my old notebook I tried to use just lagged and was horrible.
Will give this a try, thank you so much. Happy new year, God bless you and your family abundantly always 🙂🙏🏼❤️
Happy new year to you too! If you're trying to go from OBS to a different OBS session, consider looking into the NDI plugin as well!
Also a shoutout to NDI which works much better in OBS now, and can be used for OBS -> OBS streams instead with better performance!
Nice video, man. Is there a way to stream from this program through the Ethernet port using UDP?
I tried this on latest OBS Studio but I cant get it to work. Connecting form other PC on Windows with VLC doesnt work, it says cant open socket. Opening locally VLC also doesnt work, it just shows audio no video. I followed all the settings you showed in the video.
Genius!
UDP out on vmix?
I tried, but not work for me.
I used both IPs, ipv4 and sub mask ipv4. No one is working with VLC.
nice idea but i still got a problem, i want to stream lokal to a tablet and dont know hoe to recive the stream on the laptop, i cant start a console...
I was trying this on two windows machines but couldnt get it working neither with Mplayer nor with VLC. VLC simply shows nothing while mplayer outputs "stream non seekable" to console
i'm having trouble getting this working with windows 10 and using VLC. my UDP stream will connect but no image will be displayed.. i'm trying to multicast the video so multiple PCs can view the stream
are there any additional steps for windows PCs?
I had this issue too, VLC appeared to connect but wouldn't show video. I fixed it by adding ?pkt_size=1316 to the end of the URL in the OBS recording settings so it looks like this - udp://192.168.1.25:8081?pkt_size=1316
This has been a really helpful thread too, obsproject.com/forum/threads/obs-studio-send-an-udp-stream-to-a-second-pc-using-obs.55379/page-3
Yeah, I think raw UDP packets can be very quirky. I think using RTSP with a container such as mpegts would probably be more stable (albeit with TCP overhead), and it would also ensure that the codec and time info is sent with the stream, rather then the receiving end trying to guess it...
i need the "low quality webcam indian guy" version of this video. discord is being ass at streaming and my roommate just wants to stream her game to my PC on the same network
for those that just want to get right to how to set this up. skip to 2:56
Great video! Would this work to live stream over a local network (wifi) so that multiple mobile devices and tablets (no more than 10) could view the stream? 720p would be adequate. Thanks for any help! I use vMix but the principle is the same. This is a very helpful video, thank you!
I am trying to setup a cost effective (but very functional) mobile command center that I can use as a volunteer for local public service if these services are needed. I could then feed the drone footage, and any other camera view out to the stream for officers to see. latency is critical. Would have to be under 1 second. Looking forward to any suggestions you have.
If you are trying to broadcast to multiple devices, I'd suggest looking into a streaming server such as Icecast. It can be hosted on a server to allow many clients to connect to view a stream, rather then a UDP stream to a single client.
I don't understand, how do you view what's being streamed on the other PC? You enter the URL? And I'm not using VLC I'm using OBS with the exact settings you recommended.
If you're trying to open the stream in OBS on another PC, NDI is better quality and lower latency these days.
For most other video players, you should be able to use the URL yes. You can also swap out UDP for RTSP which uses TCP by default, since RTSP/RTMP is generally more widely supported.
@@TonyTascioglu Thank you for your response! Yet I have to say, the reason I asked the question was because entering the URL gave me a 404 error. Instead of those numbers you gave, I thought that was my IP address so I entered my own IP address like that to the URL.
@@dante_hope On the sending side, it's the IP of the computer that you want to send the stream to if you're using UDP. On the receiving computer, it's the IP of itself, and 0.0.0.0 usually catches it all.
UDP streams are pushed ie, the transmitter sends it to the IP, and the receiver has to figure out what to do with it. On the other hand, some protocols are pulled (such as HTTP). In this case, the transmitter uses it's own IP to listen for connections and the receiver connects to the transmitter to pull the stream.
If it's 404ing, I would check if the port you're using is allowed on a local firewall, UDP streams can get blocked since it's usually random bytes coming in.
I'm finding OBS stream videos cut off a lot of my video. I've resized and it just won't take the proper size no matter how I use your margin lines to resize it to the same size not to cut off any of my video. I'm going to have to go with another streaminer.
very useful ,thk
I don't understand why you used the command in the cmd. Is it only to watch the stream on url? On vlc it's probably easier no?
It is easier on VLC, but I was using VLC to capture my screen! VLC usually likes to only have one instance running, so I had to use MPV to play. Looking back, I should've just screen recorded with ffmpeg, would've saved me a headache editing as well.
nice thanks !
Thanks man
O Just saw that there is a Vlc for Linux. Could you haver a try with It?
I used VLC for Linux when filming the video... It works, as long as the firewall is set appropriately.
I get an error saying 'mpv' is not recognized as an internal or external command,
operable program or batch file. I tried installing MPV but it doesn't work. I have VLC installed, and when I type in VLC instead of mpv it writes the same error. Any help?
Do you have the video player binaries in your PATH variable? That's where *nix searches for binaries to run, usually it includes /usr/bin/ and such.
If you do 'which vlc' for example, it should tell you where the vlc executable is if it is in your path, else, you might need to find it on your drive separately.
hi! It was pretty. I'm a rookie for this computer usage but I tried to do that, and coudn't do it. Tried to stream to another computer and says: 'Invalid Path or Connection URL. Please check your settings to confirm that they are valid.' Any clue? I followed every step u did
Hello,
Try checking your firewall settings to see if the port you are using is open for UDP connections. You need the port allowing incoming UDP connections on the receiving end and allowing outgoing UDP packets on the transmitting end.
great advice, thanks. can you help me? I need to send a OBS output from my computer to my friend's OBS who is based n a different office. He can then relay streaming my signal to UA-cam?
If you're doing it now, and on a local network, look into the NDI plugin for OBS! It's better performance for going OBS to OBS
You are half-Turkish or something?
I can stream on the same PC but not another pc...
I might use this or NDI i'm not sure. I bought a 50ft HDMI cable and my cameras don't work over that, but I have plenty of ethernet cabling and a network switch in the room with the cameras.
If you have plenty of Cat6 cable and a switch, go for it. NDI is surprisingly good these days to go between OBS sessions or with other software/hardware supporting NDI (as opposed to when I recorded this, where I couldn't get it working and it was very experimental). NDI is much more bandwidth heavy then a simple h264 stream though, so you'll almost certainly need a wired connection if you're going to run multiple camera.
If you're running something like this, RTSP (or RTMP for multiple clients) is much more reliable then UDP since it's a more standard protocol and also uses TCP by default.
What would the best solution be for streaming multiple sources to one client? What I'm trying to do is stream the screen from 2 gaming PCs onto each half of the screen of a laptop. The laptop is hooked up to a projector as a kind of spectator screen for a LAN game. Also the latency has to be really low because the game depends heavily on timing. (Breat Saber) On the other hand resolution can be as low as 540p because it's only being displayed on half of a 1080p projector anyway..
Hi. I'm trying to set up my OBS for streaming with 2 PCs set up on Windows and i can't use NDI because one of CPUs doesn't support ssse3. Do i need for this capture card? How much it would affect gaming pc? How to do console comands which you did on Windows?
No, you don't need a capture card for this, but using HDMI output to an HDMI capture card would probably have higher video quality. There are decent ~$10 HDMI capture cards now that can do 720p60 or 1080p30. Otherwise, you don't need to do the console commands on Windows, I was only using it to show the output. You can just open the stream in VLC by going to File->Open Network Stream.
@@TonyTascioglu : i used the VLC method as i am using windows the cmd method didnt work. but the VLC one also didnt work. I have already created new rules to enable port 8081 for UDP
To get started goto 2:51
And how u do if it's not local network?
While you can port-forward, if you're going outsite the local network, you may want to switch the raw UDP packets for RTSP (which uses TCP). Also, it you need multiple clients, you can then use rtmp on nginx or Icecast to relay the stream.
How to connect to the host on windows? Use chrome?
You can open the stream in VLC media player by going to File->Open Network Stream.
!Important!
VLC Player 3.x.x doesent work. Install version 2.2.8 on your end-device!!!
Show!
Still working on version 27.2.3 :)
This music is so damn bitchin'.
Wow is it UA-cam video without any adds¿
WHY THE MUSIC?? WHY????
Ugh, I know. I didn't know any better. I've since stopped putting background music.
I used to think it made the video less boring (and to a lesser extent hid some of the questionable mic quality)
My adhd couldn't handle this video. I'd love to see a new video on this that has a script and isn't rambling about the different options and what they do, just want to know how to broadcast OBS to my LAN.
@Jeroen van der Horst Or if they just cut to the chase, maybe the video would be more popular and have more likes/subs in general. The point was constructive criticism, but you're acting like took a walk down the street in Alabama with an ice cream cone in my back pocket.
I know my videos tend to get a bit rambly, it's something others have pointed out as well.
If you're looking for a scripted solution and don't need to full UI of OBS, you can just use FFMPEG. It's command line, and would be much easier to integrate into a script.
I have used these guides before and it's worked, depending on if you want one-to-many or point-to-point.
Screen capture: trac.ffmpeg.org/wiki/Capture/Desktop, and encoding to a stream: trac.ffmpeg.org/wiki/StreamingGuide
If you want OBS for point-to-point to another OBS instance, NDI is much easier then this.
If you want to do a local stream like UA-cam or Twitch, then Owncast is another option, and uses the regular streaming mode of OBS.
aw this is for linux not windows, go make a windows version tut plz
NDI is your friend! I had it working without issues on Windows, and it's probably going to work better if you're streaming from OBS to another OBS instance!
very nice tut. but sir, i ran into a complication. i want to view my stream with vlc on another network. i discovered that i can view my stream on vlc in another device (phone) if only i am connected to the same area network. what is the solution if i am to view from other network, maybe data from my phone.
perhaps could you add NAT forwarding port in your router ? or adding an other LAN card on your computer to connect to the other network, on different IP range
Most likely you're going to have to port forward and all.
Instead of using your local IP, you'd be using your public IP or a domain name you setup and connected with the port in the router settings.
While you can port-forward, if you're going outsite the local network, you may want to switch the raw UDP packets for RTSP (which uses TCP). Also, it you need multiple clients, you can then use rtmp on nginx or Icecast to relay the stream.
how can i watch the udp://@ipaddress:8081 stream from my android phone?