Given what OBS does (screen grab and encode) it would seem that there should be a simple way to capture a window and create a local video stream from it. This could then be viewed remotely served from your home PC, or used as an input in the composition for a stream scene.
This is clearly done using a HW video capture device, but that is expensive and given everything is already digital, seems like an odd detour.
An example use case for this is if you were using a separate Windows laptop of tablet for drawing and wanted to be able include it in a Twitch stream. Web cameras do this and use the RTSP protocol. So I went looking for a simple way to set this up on a new machine.
OBS
The obvious choice might seem to be OBS as a producer of this. However this is a very large installation for a simple server encode. That said I tried to set this up and I did not have much success (OBS Studio 26.0.2). I was expecting to be able to set up a custom stream target and set the output encode to be:
rtsp://localhost:544/live
However this seemed to hang OBS.
OBS-RTSPServer
I then tried an OBS RTSP extension (OBS-RTSPServer 1.1.3) which did work nicely:
https://obsproject.com/forum/resources/obs-rtspserver.1037/
But this still seems like overkill for a simple screen grab and stream.
VLC
Given this is installed on all the machines and that it also should provide RTSP support. I tried this. However I could not get it working.
It is supposed to have full screen and screen crop options, so not great for a window capture, but I could not get those to work either.
So… there still seems like there should be a simpler solution.
happytime-rtsp-server-x64
This is the sort of thing I was looking for. It was a simple, small, standalone programme that could act as a screen grabber and an RTSP server. The setup was very simple:
- Download from http://www.happytimesoft.com/products/rtsp-server/index.html
- Unzip
- Update config.xml
- Run RtspServer.exe
Here are some pros and cons:
- It allowed for password protection which is nice.
- The free trial version is limited to a max of 4 streams.
- Release version is over £300 which implies their target audience is professional setups.
- Earlier versions would only grab the full screen.
- The work around is to crop and resize in the compositing OBS scene.
- Using version 6.6 there is a window name capture option.
- There is a long latency.
- This might not matter if you are sketching something for the viewers.
- This might also be able to be improved with some of the encoding settings.
Setup
Find the window name with the command
RtspServer.exe -l window
This shows you what windows it can capture. Then add that window name in the <output><url>
<url>rtsp://localhost:554/window=*Untitled%20-%20Notepad</url>
Note it is very picky. It has to be the current name of the window. If it changes then it will not work. Also the window name has to have the spaces replaced with %20.
Once this is then running the stream can be connected to with the same full url (including the window=
Summary
So we are very close and we only really miss out on the real time requirement. We did get named window capture, and encode to as an RTSP stream from a local PC.