Dynamic Stream Configuration with URL Parameters
The media server supports dynamic configuration through URL query parameters. This allows you to customize stream properties on-the-fly without modifying server configuration files.
The general format is:
rtsp://[serverip]:[serverport]/[application-name]/test.mp4?param1=value1¶m2=value2
Key Advantage: Parameters specified in the URL have higher priority than those configured in the server's configuration file. This enables dynamic, per-request customization.
Parameter Categories
URL parameters are categorized for clarity. Unless otherwise specified, parameters apply to all streams.
- ve H264, H265, JPEG, MP4 Specify video encoding format.
- w e.g., 1920 Set video width in pixels.
- h e.g., 1080 Set video height in pixels.
- fps e.g., 30 Set video frame rate (frames per second).
- vb e.g., 4000 Set video bitrate in kbps.
- ae PCMU, PCMA, G726, G722, OPUS, AAC Specify audio encoding.
- sr e.g., 44100 Set audio sample rate in Hz.
- ch 1, 2 Set the number of audio channels (mono/stereo).
- ab e.g., 128 Set audio bitrate in kbps.
- t unicast, multicast Specify the transmission method.
- p udp, tcp Specify the transport protocol (RTP over UDP or TCP).
- srtp 0, 1 Enable (1) or disable (0) SRTP encryption.
Practical Examples
Apply multiple parameters in a single URL to achieve the desired stream configuration.
Example 1: High-Quality H.264 Stream
Unicast RTP over UDP, H.264 video, 1080p resolution, 30fps, 4Mbps bitrate, AAC audio, 44.1kHz, stereo.
rtsp://192.168.1.100:554/live/test.mp4?t=unicast&p=udp&ve=h264&w=1920&h=1080&fps=30&vb=4000&ae=aac&sr=44100&ch=2
Example 2: Low-Bandwidth H.265 Stream
Unicast RTP over TCP (firewall-friendly), H.265 video, 720p resolution, 15fps, 1Mbps bitrate, OPUS audio.
rtsp://192.168.1.100:554/live/test.mp4?t=unicast&p=tcp&ve=h265&w=1280&h=720&fps=15&vb=1000&ae=opus
Example 3: Secure Multicast Stream
Multicast transmission with SRTP encryption enabled.
rtsp://239.1.1.1:554/live/test.mp4?t=multicast&p=udp&srtp=1
Best Practices & Tips
- Parameter Order: The order of parameters in the URL does not matter. Use a logical order for readability.
- URL Encoding: Ensure special characters (like spaces) in values are properly URL-encoded.
- Performance: Higher resolution, frame rate, and bitrate require more CPU and bandwidth.
- Compatibility: Choose encoding formats (H.264, AAC) for maximum player compatibility.
- Firewall Traversal: Use
p=tcpwhen UDP is blocked by firewalls. - Security: Enable
srtp=1for encrypted streams in sensitive environments.