RSTP Web Camera Demo

This page introduces how to use the camera through RSTP stream on Ubuntu 20.04.

Installation dependencies

Demo mainly uses opencv and flask frameworks.

  1. Install opencv
khadas@Khadas:~$ sudo apt install libopencv-dev python3-opencv
  1. Install flask
khadas@Khadas:~$ sudo apt install python3-pip
khadas@Khadas:~$ pip3 instal flask

Run Demo

  1. Clone source code
khadas@Khadas:~$ git clone
  1. Check camera node

Before plugin camera,

khadas@Khadas:~$ ls /dev/video*
/dev/video0  /dev/video10  /dev/video11  /dev/video12  /dev/video13  /dev/videosync

After plugin camera,

khadas@Khadas:~$ ls /dev/video*
/dev/video0  /dev/video1  /dev/video10  /dev/video11  /dev/video12  /dev/video13  /dev/videosync

Camera node is /dev/video1.

  1. Run Demo
khadas@Khadas:~$ cd rtsp-web-appliation/
khadas@Khadas:~/rtsp-web-appliation$ python3 --device 1
 * Serving Flask app 'rtsp' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 707-481-604

Open the link to see the effect of the Demo