How to setup and configure the RTSP stream with port forwarding

camera Feb 23, 2020

Why do we need port forwarding?

Most IP cameras operate in the Local Area Network. To make them accessible by a 3rd party vendor, we should apply port forwarding between ports on a  static IP and cameras' RTSP stream ports.

Static IP must be accessible by the entity you'll stream to.

Let’s say our static IP is 38.142.141.11

What do we need?

  1. An RTSP supported IP Camera - RTSP stands for Real-Time Streaming Protocol.
  2. A static IP on your router - This can be provided by your Internet provider
  3. A port on the provided static IP - Different port for each camera
  4. RTSP Stream URL structure - Different for each brand

How do I configure port forwarding?

  1. Go to the router interface
  2. Open the port forwarding section in the router
  3. Most of the routers’ port forwarding panel can be found in this website https://portforward.com/router.htm
  4. Give a name for the description - Warehouse 2 / IP Cam 1
  5. Specify the IP addresses of each camera will be connected. Let’s say 192.168.1.11
  6. Set the protocol section TCP/UDP
  7. The external port is the port will be addressed on static IP. So it can be chosen as any empty port on the static IP. Let’s say port 5001. So set both external ports as 5001 - 5001
  8. The internal port is the port in which the RTSP stream will be published from the IP Camera. Port number 554 is the RTSP stream port for nearly all IP cameras. So let’s set 554 - 554 as the Internal Port
  9. Add the forwarding rule to the list

In the end, the port configuration on the port forwarding section of your router will look like this.


Now when you connect 38.142.141.11:5001 the actual address you’re reaching will be 192.168.1.11:554

You can use telnet command on your computer’s terminal to test if the camera’s RTSP port is accessible

Telnet 38.142.141.11 5001

If the response is an escape character the connection is OK. If nothing happens that means there is a problem with

  • the port forwarding
  • or static IP

How do I find my camera’s RTSP URL

When the telnet response indicates that the RTSP port of the camera is accessible next step is building the RTSP URL for the system we will stream to.

Finding the right RTSP URL structure is the most challenging part because it is different for each brand and model. But don’t worry, you can find it in less than 10 minutes with a Google search. Could not find it? You can raise a support ticket to your camera provider or write to us. We’re here to help :)

Here are some examples

  • HikVision
    rtsp://admin:admin123@38.142.141.11:5001/Streaming/Channels/101/
  • Bosch
    rtsp://38.142.141.11:5002/rtsp_tunnel

Once the RTSP URL is generated it can be tested with software like on VLC

How do I test my RTSP URL?

  1. Download VLC media player
  2. Open VLC
  3. Click on the File menu
  4. Select Open Network
  5. Paste the generated RTSP URL to the URL textbox
  6. Click Open

The video stream will start in less than 10 seconds

Can I test the RTSP stream via the terminal window?

1. Open your terminal

2. Install FFmpeg

brew install ffmpeg

3. To test the accessibility run:

ffprobe rtsp://admin:admin@38.142.141.11:5001/Streaming/Channels/101/

4. To play the video stream run:

ffplay -rtsptransport tcp rtsp://38.142.141.11:5002/rtsptunnel