← All How-To Guides
Troubleshooting

Troubleshoot an RTSP Camera Stream

Start at the camera, test one network boundary at a time, and use the actual RTSP response to distinguish a bad password from a bad path, blocked port, or unsupported codec.

11 min read Difficulty: Intermediate

1. Identify exactly what is failing

“The camera is offline” can describe several unrelated failures. Write down the first point in the path that does not work before changing settings.

ObservationWhat it provesWhat it does not prove
Camera opens in its mobile appThe camera and vendor-cloud path are aliveLocal RTSP is enabled or reachable
Camera web page opens locallyThe IP and local route are correctTCP port 554 is open
Camera answers pingICMP reaches the addressRTSP is enabled or allowed through a firewall
VLC opens the RTSP URL locallyCredentials, path, port, and local decoding workThe cloud/VPN route works
LightNVR Test Connection succeedsThe recorder can open the sourceA useful recording has closed and is playable

Keep the test URL, camera IP, test location, and exact error message together. Those four facts usually identify the failed layer without guesswork.

2. Prove the camera works locally

  1. Connect a laptop to the same LAN or VLAN as the camera.
  2. Open the camera’s web interface and verify its configured IP, RTSP port, and stream encoding.
  3. Confirm RTSP is enabled; some manufacturers ship it disabled.
  4. Use a camera-local account with permission to view the requested channel.
  5. Open the exact RTSP URL in VLC under Media → Open Network Stream.
Consumer-camera apps often play video through a vendor relay. A working app therefore says nothing about whether the camera exposes RTSP on the LAN.

Use the vendor-specific guide when you need the correct path:

3. Test the network path and RTSP port

Run these from the same network location as the recorder whenever possible.

Confirm the address resolves to the intended camera

ping -c 3 192.168.1.100

A failed ping is useful, but a successful ping is not the finish line: cameras and firewalls can treat ICMP and RTSP differently.

Test the actual TCP port

nc -vz -w 5 192.168.1.100 554
  • Succeeded: a service accepted a TCP connection; continue with the URL and authentication test.
  • Connection refused: the host is reachable, but nothing is listening on that port—or the device rejected it.
  • Timed out: routing, a firewall, an ACL, or a stale IP is dropping the traffic.

For a cloud recorder, verify the private route

  • Check that WireGuard shows a recent handshake.
  • Confirm the camera subnet is routed through the tunnel.
  • Check that the camera’s reply route returns through the tunnel gateway.
  • Check inter-VLAN rules if cameras are isolated from the gateway.
Do not solve a routing problem by forwarding port 554 from the public internet. Use a private WireGuard tunnel instead.

4. Inspect the stream with ffprobe

VLC tells you whether a picture appears. ffprobe is better at exposing the codec and transport errors that a player may hide.

ffprobe -v warning -rtsp_transport tcp \
  -show_entries stream=index,codec_type,codec_name,width,height,r_frame_rate \
  -of default=noprint_wrappers=1 \
  "rtsp://username:password@192.168.1.100:554/STREAM_PATH"

A healthy video response resembles:

index=0
codec_name=h264
codec_type=video
width=1920
height=1080
r_frame_rate=15/1

Force TCP for the first diagnostic pass. UDP can be efficient on a clean LAN, but packet loss and firewall behavior make it a poor baseline while you are still proving the route.

5. Translate common errors

Error or symptomLikely layerNext check
401 UnauthorizedCredentials or permissionsCamera-local user, password encoding, channel permission, account lockout
403 ForbiddenPermissions or session policyLive-view role, connection limit, camera security policy
404 Not FoundRTSP stream pathVendor URL format, channel number, main/sub stream suffix
Connection refusedPort or serviceEnable RTSP and confirm the configured port
Connection timed outIP, route, firewall, or VLAN ACLDHCP lease, tunnel route, return path, TCP 554 rule
Invalid data or decoder errorsCodec or malformed streamSwitch to H.264, disable smart codec, test sub stream
Works briefly, then disconnectsConnection cap, Wi-Fi, or keyframesConcurrent viewers, signal quality, I-frame interval

Passwords with special characters

Credentials are part of the URL authority section. Reserved characters must be percent-encoded there—for example, @ becomes %40 and # becomes %23. Encode the credential value, not the entire RTSP URL.

6. Check LightNVR

  1. Open Streams and edit or add the camera.
  2. Paste the known-good local URL into Stream URL.
  3. Select Test Connection and preserve the full returned message.
  4. If the test fails, open System → System Logs, select an appropriate log level, and reproduce the failure.
  5. Match the timestamp and stream name to the newest connection error.

If the main stream is heavy, put the camera’s lower-resolution feed in Sub Stream URL. LightNVR can use the lighter stream for multi-camera views while retaining the main feed for recording.

A successful connection test is only one checkpoint. Confirm a live picture, wait for a recording segment to close, and play that recording back before declaring the camera finished.

7. Fix freezing, gaps, and high CPU

Start from a conservative baseline

  • H.264 video
  • 1920×1080 or lower
  • 10–15 frames per second
  • A fixed 2–4 Mbps bitrate for 1080p
  • An I-frame interval close to the frame rate
  • Smart codec, H.264+, or H.265+ disabled during diagnosis

Measure the site’s upload budget

Add the configured bitrate of every continuously recorded camera, then leave headroom for VPN overhead, normal internet traffic, and bitrate spikes. Four cameras configured at 4 Mbps need roughly 16 Mbps continuously; a connection that merely peaks at 16 Mbps is not enough.

Change one variable at a time

  1. Prove the sub stream is stable.
  2. Switch the main stream to H.264.
  3. Reduce frame rate, then bitrate, then resolution—testing after each change.
  4. Inspect camera Wi-Fi signal or switch to Ethernet.
  5. Check recorder CPU, memory, and system logs while the failure occurs.

If you still need help, send support the camera model and firmware, a redacted RTSP URL, the exact Test Connection error, and the matching log lines. Never send the camera password.