23
June
2025
How to play RTSP video streaming in VLC player and others
10:34

How to play RTSP video streaming in VLC player and others

23 June 2025 10:34

This article is only about DVRs Dahua. How to set up RTSP playback over a computer network?

Introduction

The task is to play using the RTSP protocol (rtsp://ip_address) video from a specific IP address.

Setting up RTSP from the DVR side

1) Connect the DVR to the computer network (and check in Settings - Network -IPv4- DHCP, that the IP address for the registrar was allocated by a DHCP server).
2) In the recorder menu "Accounts" create a user, for example, "viewer", with the rights "user" - limited rights only for viewing video from cameras.
3) In the DVR settings "Camera"-"Compression" enable and configure additional thread: instead of h.265 (HEVC) codec specify h.264, MPEG-4, mpeg4 with reduced resolution (704 by 576 pixels - D1 format).

Configuring RTSP from the Wi-Fi router

  • In the DHCP server settings, provide the DVR with a static IP address (the "make static" button or similar).

Setting up RTSP playback from a personal computer

1) If VLC player is installed from the repository, you need to delete it and the ~/.config/vlc folder.

sudo apt remove vlc

2) Install VLC media player from Snap store.

On most OSes, the Snap Store preinstalled. Checking the installation of Snap: run the command in Terminal snap --version.
The VLC version from Snap is compiled with key support --enable-live555 for RTSP playback. A regular player from the repository does not support playing the RTSP stream.

You need to download the latest version of VLC player:

sudo snap remove vlc
sudo snap install vlc --channel=latest

To prevent a crash when starting vlc for the first time, you need to clear the font cache.
(Otherwise you will get the error "Fontconfig warning: FcPattern object weight does not accept value [0 205)".

sudo rm /var/cache/fontconfig/*
rm ~/.cache/fontconfig/*
fc-cache -r

Also, I deleted the previous configuration files from the old version of VLC:

rm -rf ~/.config/vlc
rm -rf ~/snap/vlc

3) Launch VLC media player from the command line (to see messages when starting the program)

vlc

Launching VLC from Snap for the first time can take up to 1.5 minutes.

If prompted by the program, perform the initial setup.
vlc1
vlc2
vlc3
vlc4

4) In the menu "Media"
vlc-main
select item "Open URL" and create a connection string:
vlc5

rtsp://username:password@192.168.1.100:554/cam/realmonitor?channel=12&subtype=1

where:
username - DVR user name with video viewing rights,
password - user password username of the DVR user with video viewing rights,
192.168.1.100 - replace with the IP address of the video recorder on the computer network,
554 - standard RTSP protocol port,
channel - camera number (1-16),
subtype - select the main (0) or additional (1) stream.
(The additional stream has a lower resolution and frame rate for transmission over a limited bandwidth network (Wi-Fi)).

After a short pause of 1-2 seconds, video playback will begin.
vlc6

If there is no image, an error message will appear. To debug the connection, use the menu Tools-Messages-Detailing- 2 (debugging)
and try connecting again and view the output in the Tools - Messages menu.

If the image is there, there are no errors, in the future you can run the program from the menu "Start"-"Multimedia"-"VLC Media Player".

Setting up RTSP on a device running Android OS

After video playback from the camera on the computer is debugged, you can start launching the RTSP player under Android OS.
Since the customized connection string can be used without changes between Linux and Android OS in RTSP video players.

There are several applications for playing RTSP stream on Android. Search the app store using the keywords "RTSP player":

Example programs:
RTSP Player (by Damian Hoppe)- Play Market ("RTSP Player" requires Android 6.0 Marshmallow and higher),
Cameras (author Vladislav Yurievich Pen)- RuStore (for the "Camera" application you need Android 7.0 Nougat and higher).

In the programs, the setup is simple: you need to come up with and enter a name for the camera and fill out the connection line with the RTSP connection address. username and password, IP address, port 554, camera number and additional stream No. 1 as indicated above in the VLC for PC settings paragraph.
The connection line to the DVR is exactly the same as in the case of the VLC player:

rtsp://username:password@192.168.1.100:554/cam/realmonitor?channel=12&subtype=1

The sub stream rate (bitrate), resolution and frame rate in the DVR should be adjusted so that the image remains clear at the minimum bitrate. For example:

  • resolution 362*288 (CIF)
  • frame rate: 10 fps
  • I-frame interval: 2 seconds
  • bitrate: 192 Kb/s

Illustration: FreePic "security guard at workspace".