Resource icon

How to Setup Multi Instance OBS for Streaming Multiple RTSP

This guide is for those that have multiple cameras that all need their own individual stream. The following information below will include: how to setup multiple OBS instances, how to setup multiple instances to restart with windows, how to reset/prevent a frozen RTSP feed automatically using advanced scene switcher, and hardware that may help accomplish all of this.



Requirements:

Download OBS Studio which can be found on the OBS website or via their github releases.

After installing OBS Studio, you will need to install Advanced Scene Switcher.

After installing Advanced Scene Switcher, make sure OBS Studio is closed.



-------------------------------------------------------------------------------------------------------------------------------------------



1. You will need to create a new folder for your first instance of OBS Studio. Then go to your obs-studio directory(normal found in Program Files) and copy bin, data, and obs-plugins folders, and paste into the new folder.

2. In the new instance folder, create an empty folder called config.

Next, create a .txt file named obs_portable_mode.txt. Nothing needs to be added to the file, it just needs to have that file name. This will make it so OBS runs in portable mode and will be instanced from any other OBS instances.

3. Lastly, you will need to go into bin\64bit and create a shortcut. Copy this shortcut into your Startup folder. You can access this folder by typing in shell:startup in the run window by pressing windows+r.



(If you already know how to setup an RTSP feed on OBS, then skip to the next section.)



-------------------------------------------------------------------------------------------------------------------------------------------



Creating RTSP source for OBS.

1. Open OBS and create a new source.

2. Add Media Source

3. Uncheck Local file.

4. Put your RTSP address/link into input.

5. Check or uncheck Use Hardware Decoding depending on your hardware and preference.(Hardware decoding will use GPU decoder, otherwise it uses CPU.)

6. This step is optional, but I find that I need to use it frequently. For FFmpeg Options, enter rtsp_transport=tcp rtsp_flags=prefer_tcp. This will help if you are only seeing a black screen for the RTSP feed.



-------------------------------------------------------------------------------------------------------------------------------------------



Setting up Advanced Scene Switcher.

1. At the top of the windows click Tools and select Advanced Scene Switcher.

2. Under the General tab, click start.

3. Under the Macro tab, add a new Macro. This will be to hide the scene, which will kill the RTSP feed. Name the macro whatever you want.

4. Click the plus for Macro conditions.

5. It will show "If" and "Scene." Change Scene to Timer.

6. Change duration to your preference of whenever you would want RTSP feed to refresh.

7. Click add under Macro conditions.

8. Change Switch Scene to Scene Item Visibility.

9. Select scene you want to target.

10. Select Hide.

11. Select the scene item(media source added previously.)

12. You will need to make sure you have the check box selected at the top for "Run macro in parallel to other macros."

13. Create another new Macro. This will be to show/reconnect the RTSP feed. Name it whatever you want.

14. Repeat step 5.

15. Leave duration at 0-5 seconds. Your preference for how long you want a black screen.

16. The macro condition will be the same, except instead of selecting Hide, you will select show.



The steps above will essentially kill the RTSP feed according to whatever you set on the timer. It should then be attempting every 0-5 seconds to show/reconnect the RTSP feed.



-------------------------------------------------------------------------------------------------------------------------------------------



The following are not requirements, but very strong suggestions as to what kind of hardware you will need to run depending on the number of cameras you may have.



It's typically a good idea to have a decent CPU. Bare minimum would be a v3/v4 Xeon. Newer Intel CPUs like 10th-13th gen and Ryzen 5000 CPUs should be very decent as well. You may be able to use Intel QuickSync encoder as well to help. I have only tested with v3 Xeon's and a Ryzen 7 5800x(the Ryzen chip seems to fair better, but it is newer.)



You will absolutely need a GPU as OBS will use it for rendering and compositing everything. It's best to try to use an Nvidia GPU as most modern NVENC encoders are pretty stout. Pascal or Turing is preferred for architecture.



You can use Nvidia's Video Encode and Decode Matrix to help find what codecs and formats are supported. Not all NVENC are born equal.



The best architecture that makes sense price wise is Turing. You can do consumer cards, but you will need to patch the driver so it will have unlimited sessions(normal limit is 8.) To give an example, I am using an RTX 3050, and it has 13 NVENC sessions running and it's only at about 68% encoder usage, but GPU usage it 80-85%, and about 75% VRAM usage.



If you are more on a budget, a used Quadro/Tesla may be more up your alley, and you can run multiple and they have unlimited NVENC sessions out of the box. Popular options are Pascal Quadros like P2000-P4000. Pascal Tesla options would be the Tesla P4 or Tesla P100. Each of these have multiple encoders, which definitely help. You will need to keep VRAM usage in mind.



You can also use multiple GPUs. My testing in this is very limited, and I've only used one card for encoding at a time. For simple RTSP feeds, there shouldn't be any discernable difference in using multiple GPUs. In my testing with a Quadro M4000 paired with a Tesla P100 in WDDM mode, I was able to have it primarily use the P100 for encoding and rendering, but the M4000 was still rendering the UI(usage on M4000 would drop to 0% when minimizing OBS windows.) During testing the P100 could handle four 4k30->1440p30 and the encoder was only at 25%.
Author
dgallentine
Views
1,023
First release
Last update
Rating
0.00 star(s) 0 ratings
Top