> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dwe.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# dweOS to OBS Studio

> This guide is to help you setup streaming from dweOS to OBS Studio.

<Warning>
  dweOS does not officially support streaming to OBS. The following steps are for Linux and Windows only.
</Warning>

<Steps>
  <Step title="Check dweOS">
    After following the dweOS setup, continue to next steps.

    <Note>
      Note down the port(s) being streamed to.
    </Note>
  </Step>

  <Step title="Install OBS Studio">
    <Card title="Download OBS Studio" icon="video" href="https://obsproject.com/">
      Click here to download OBS Studio for Desktop on your Laptop/PC.
    </Card>
  </Step>

  <Step title="Install GStreamer">
    <Tabs>
      <Tab title="For Linux">
        Within the terminal, run:

        ```sh theme={null}
        sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools                
        ```

        Install the development headers as well for plugin use:

        ```sh theme={null}
        sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
        ```
      </Tab>

      <Tab title="For Windows">
        <Steps>
          <Step title="Install GStreamer">
            <Card title="Download GStreamer Framework" icon="stream" href="https://gstreamer.freedesktop.org/download/#windows">
              Click here to download GStreamer for Desktop on your Laptop/PC.

              <Note>
                Make sure to download the MinGW version, and install both runtime and development.
              </Note>
            </Card>

            <Tip>
              When in doubt, install the 64-bit version, as this is more common.
            </Tip>

            <Warning>
              GStreamer would automatically install in the D drive if you have more than one drive on your PC. You can change it to the C drive when you do custom installation.

              If you install it on the D drive, just keep note of that when you set up your environment variables below.
            </Warning>
          </Step>

          <Step title="Configure Environment Variables Setup">
            <Steps>
              <Step>
                To get to Environment Variables, press `Win + R`
              </Step>

              <Step>
                Type:

                ```
                SystemPropertiesAdvanced
                ```

                and press `Enter`
              </Step>

              <Step>
                Click `Environment Variables...`

                <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/system-properties-dialog.png?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=e43b7911ce525ec2b854c971afa1266b" width="80%" alt="System Properties Dialog" data-path="dwe-os/legacy/images/system-properties-dialog.png" />
              </Step>

              <Step>
                Highlight the variable `Path` under `User variables` by clicking on it and then click `Edit…` under the `User variables` box.

                <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/environment-variables-dialog.png?s=2d7ac09a6778fd1ceafd7a177335a9eb" width="80%" alt="Environment Variables Dialog" data-path="dwe-os/legacy/images/environment-variables-dialog.png" />
              </Step>

              <Step>
                A new window should pop up and you want to click on `New` and add a path to your bin folder to the list. In this case, it’s:

                ```
                C:\gstreamer\1.0\mingw_x86_64\bin
                ```

                The path to your bin may vary and can be found from where you installed GStreamer in previous steps.

                <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/environment-variables-dialog-2.png?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=84f2d6d273839b4a87e6f3346a66014b" width="80%" alt="Second Environment Variables Dialog" data-path="dwe-os/legacy/images/environment-variables-dialog-2.png" />
              </Step>

              <Step>
                After that, click `OK` on both windows and you should be ready to go!
              </Step>
            </Steps>
          </Step>

          <Step title="Success!">
            You should now have GStreamer setup and ready for next steps!
          </Step>
        </Steps>

        <Tip>
          To verify the GStreamer setup, open `CMD` and run the following:

          ```sh theme={null}
          gst-launch-1.0 --version
          ```

          This should result in an output like:

          ```sh theme={null}
          gst-launch-1.0 version 1.16.2
          GStreamer 1.16.2
          https://launchpad.net/distros/ubuntu/+source/gstreamer1.0
          ```
        </Tip>
      </Tab>
    </Tabs>
  </Step>

  <Step title="Install OBS GStreamer Plugin">
    <Tabs>
      <Tab title="For Linux">
        <Steps>
          <Step>
            Download the latest plugin build [here](https://github.com/fzwoch/obs-gstreamer/releases/).
          </Step>

          <Step>
            From the `.zip` file extract and locate the `obs-gstreamer.so` file within the `linux` folder.
          </Step>

          <Step>
            In another file explorer, locate the `obs-plugins` folder, or run this command in terminal to grab the path:

            ```sh theme={null}
            sudo find /usr/lib -name "obs-plugins" -type d
            ```

            <Tip>
              This is likely to be similar to `/usr/lib/x86../obs-plugins`.
            </Tip>
          </Step>

          <Step>
            Move the `.so` file into the `obs-plugins` folder, or from the terminal, run:

            ```sh theme={null}
            sudo mv ~/Downloads/linux/obs-gstreamer.so /usr/lib/x86_64-linux-gnu/obs-plugins/
            ```

            <Warning>
              In this case the location of my `obs-gstreamer.so` is `~/Downloads/linux/obs-gstreamer.so`, be sure to replace it with the path where you extracted the `obs-gstreamer.so` file.

              Remember to replace the `/usr/lib/x86../obs-plugins` with your `obs-plugin` folder path as well.
            </Warning>
          </Step>

          <Step>
            Restart OBS Studio should you have it running.
          </Step>
        </Steps>
      </Tab>

      <Tab title="For Windows">
        <Steps>
          <Step>
            Download the latest plugin build [here](https://github.com/fzwoch/obs-gstreamer/releases/).
          </Step>

          <Step>
            From the `.zip` file extract and locate the `obs-gstreamer.dll` file within the `windows` folder.
          </Step>

          <Step>
            In another file explorer, locate the `obs-plugins\64-bit` folder (or whichever bit size you installed)

            <Tip>
              This is likely to be similar to `C:\Program Files\obs-studio\obs-plugins\64bit`.

              If you can't find it, right-click your OBS Studio shortcut on the desktop or Start Menu, select `Open file location`, and navigate up one level to the main `obs-studio` folder, where you'll find the `obs-plugins` folder.
            </Tip>
          </Step>

          <Step>
            Move the `.dll` file into the `obs-plugins\64-bit` folder.

            <Note>
              Windows will likely ask for Administrator permission to move files into C:\Program Files. Click `Continue` or `Yes`.
            </Note>
          </Step>

          <Step>
            Restart OBS Studio should you have it running.
          </Step>
        </Steps>
      </Tab>
    </Tabs>
  </Step>

  <Step title="Setup Stream">
    The process from here is pretty much identical across operating systems.

    <Steps>
      <Step>
        Within OBS Studios, under the `Sources` tab, press the `+` button and add a GStreamer Source.

        <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/add-gstreamer.png?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=39211fa2050be04adcf73369809e8ea8" width="50%" alt="Add GStreamer Source" data-path="dwe-os/legacy/images/add-gstreamer.png" />

        Under `Create new` name it whatever you'd like and confirm.
      </Step>

      <Step>
        You'll next be prompted with a window like this:

        <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/add-gstreamer-code.png?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=e77c79eb26e7664556f14242431dded0" width="80%" alt="Add GStreamer Code" data-path="dwe-os/legacy/images/add-gstreamer-code.png" />

        Within the `Pipeline` input, replace the existing code with:

        ```sh theme={null}
        udpsrc port=5600 ! application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264 ! rtph264depay ! avdec_h264 output-corrupt=false ! videoconvert ! video.
        ```

        <Warning>
          Replace the `5600` in `port=5600` with the port being streamed to from dweOS 2.
        </Warning>

        <Note>
          Windows may prompt you with a warning, and in that case, please enable OBS for both private and public networks

          <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/gstreamer-windows-prompt.jpg?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=6319bd32c55564f834fd1c70f9072b67" width="80%" alt="GStreamer Window Prompt" data-path="dwe-os/legacy/images/gstreamer-windows-prompt.jpg" />
        </Note>
      </Step>
    </Steps>
  </Step>

  <Step title="Adding Additional Streams">
    If you would like to add more than one stream, simply repeat from step `5`.

    <Warning>
      Remember to replace the port number as specified in the previous step!
    </Warning>

    More streams should show up on the main window of OBS. You may click on the video display to resize to your preference.
    Here is an example of a setup with 3 exploreHDs!

    <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/gstreamer-setup-example.jpg?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=da82fbd3df7e69a122e13f2bf65a9ae9" alt="GStreamer Setup Example" width="1981" height="1128" data-path="dwe-os/legacy/images/gstreamer-setup-example.jpg" />
  </Step>

  <Step title="Optimization">
    For optimizing the setup, please navigate to `File > Settings > Output`.

    Within output, set `Output Mode` to `Advanced` to access additional settings.

    Given each camera is set to 10Mb/s as the default bitrate, the streaming and recording should match that. In the case of 3 cameras, providing at least 30Mb/s of streaming and recording bitrate should provide you with high quality.

    <img src="https://mintcdn.com/deepwaterexplorationinc/NrWVR9Qe6FWmBE6d/dwe-os/legacy/images/obs-settings.jpg?fit=max&auto=format&n=NrWVR9Qe6FWmBE6d&q=85&s=32db2daea921d912b7bdbd778c93f3d0" alt="OBS Settings" width="974" height="752" data-path="dwe-os/legacy/images/obs-settings.jpg" />
  </Step>

  <Step title="Success!">
    Wonderful! You should now see the streams configured with OBS Studio.
  </Step>
</Steps>

<Warning>
  Warning: <br />
  With a 3 stream setup, this configuration will rely on a powerful GPU to run
  the videos smoothly. We found that OBS is a lot more intensive to run when
  compared to Discovery. Make sure your laptop is powerful enough to run it or
  you can lower the resolution of some of the streams to 720p.
</Warning>
