Streaming basics: RTSP & ONVIF
Getting video out of a camera is usually the first integration step.
RTSP URLs
| Vendor | Main stream | Sub stream |
|---|---|---|
| Hikvision | rtsp://u:p@ip:554/Streaming/Channels/101 |
.../102 |
| Dahua | rtsp://u:p@ip:554/cam/realmonitor?channel=1&subtype=0 |
subtype=1 |
Test with ffplay or VLC:
ffplay "rtsp://admin:PASSWORD@192.168.1.64:554/Streaming/Channels/101"
ONVIF
Use ONVIF for a vendor-neutral path:
- Discovery:
WS-Discoverymulticast (239.255.255.250:3702). - Profiles: Profile S (streaming), Profile G (recording/playback).
- GetStreamUri returns the RTSP URI above.
Tips
- Prefer the sub stream for preview/grid views to save bandwidth.
- Use TCP transport (
rtsp_transport=tcp) when behind NAT or lossy networks. - For server-side recording, the vendor SDK is more reliable than parsing RTSP yourself.