What is RTSP over HTTP?
RTSP (Real Time Streaming Protocol) typically uses ports like 554, which may be blocked by corporate or public firewalls. RTSP over HTTP wraps the RTSP control messages and data inside standard HTTP (port 80) or HTTPS (port 443) requests, allowing the stream to pass through almost any firewall that allows web traffic. It is especially useful for video surveillance, remote access, or any scenario where network policies restrict non-standard ports.
Configuration Modifications
To enable RTSP over HTTP on the server side, you need to modify the RTSP server configuration file (rtspserver.cfg). Below are the essential settings:
Step 1: Enable HTTP Tunnel
<rtsp_over_http>1</rtsp_over_http> <http_port>8080</http_port> <!-- Choose any available port -->
Step 2: (Optional) Enable HTTPS Tunnel
<rtsp_over_https>1</rtsp_over_https> <https_port>8443</https_port> <https_cert>/path/to/certificate.pem</https_cert> <https_key>/path/to/private-key.pem</https_key>
After saving the changes, restart the RTSP server. The server will now listen for tunneled RTSP requests on the specified HTTP/HTTPS ports.
Testing with VLC Media Player
VLC has built-in support for RTSP over HTTP tunneling. Follow these steps to verify the configuration:
Step 1: Open VLC Advanced Preferences
Go to Tools → Preferences (or press Ctrl+P). In the bottom-left corner, under Show settings, choose All to access advanced options.
Step 2: Configure HTTP Tunnel
Navigate to Input / Codecs → Access modules → RTP/RTSP. On the right panel, check the box "Use RTP over RTSP (HTTP tunnel)". Then set the HTTP tunnel port to the same value you configured in rtspserver.cfg (e.g., 8080).
Step 3: Play the Stream
Close the preferences. Click Media → Open Network Stream. Enter the standard RTSP URL, for example:
VLC will automatically tunnel the RTSP traffic through the configured HTTP port. If the video plays, RTSP over HTTP is working correctly.
Testing with Happytime RTSP Client
The dedicated Happytime RTSP Client provides a simpler way to test, allowing direct HTTP/HTTPS URLs.
Step 1: Launch the Client
Open Happytime RTSP Client application.
Step 2: Input the Tunneled URL
Click the play button in the video window. Enter the stream address using the following format:
- For HTTP tunnel:
http://[serverip]:[http_port]/[stream-name]
Example:http://192.168.1.100:8080/test.mp4 - For HTTPS tunnel (if enabled):
https://[serverip]:[https_port]/[stream-name]
Example:https://192.168.1.100:8443/test.mp4
The client automatically encapsulates the request as RTSP over HTTP.
Step 3: Verify Playback
Press OK. If the video renders, the tunnel is operational.
Common Issues & Tips
- Firewall rules: Ensure the chosen HTTP/HTTPS ports are open on the server and accessible from the client network.
- Certificate validation: If using a self-signed certificate for HTTPS, you may need to ignore certificate errors in the client (VLC prompts; Happytime Client may require pre‑trust).
- Performance: HTTP tunneling adds minor overhead but can improve reliability in lossy networks due to TCP retransmission.
- Not for web browsers: Do not expect to open the HTTP URL in a regular browser; browsers cannot decode RTP streams.
Configuration Summary
Key sections to verify in rtspserver.cfg:
<rtsp_over_http>1</rtsp_over_http> <http_port>8080</http_port> <rtsp_over_https>0</rtsp_over_https> <!-- Set to 1 if HTTPS needed --> <https_port>8443</https_port> <https_cert>./cert.pem</https_cert> <https_key>./key.pem</https_key>
Conclusion
RTSP over HTTP is a valuable technique to ensure streaming continuity in firewalled environments. By correctly configuring the RTSP server and using compatible clients like VLC or Happytime RTSP Client, you can easily verify the tunnel and deploy robust streaming solutions. Remember that it is a transport tunnel, not a web playback solution.