The Raspberry Pi 4 itself has a USB interface and a Gigabit network port, and the CPU is also very fast. You can use the Raspberry Pi to connect a USB camera for network video monitoring. You can check on children or the elderly at home, or use it to check fish tanks, parking spaces, etc.
1. Use the lsusb command to check whether the system supports
The Raspberry Pi uses the official system. The USB camera I found is a generic camera from decades ago. Using the lsusb command, I found that the system still supports this camera.
2. Check for details
Use the command to view video0
ls /dev
3. Check the USB camera parameters
Use the command (v4l2 is the letter l) v4l2-ctl -d /dev/video0 --all
You can see that my camera has a resolution of 640*480
4. Install motion
Install using command line
sudo apt-get install motion
5. Modify the configuration file
sudo nano /etc/motion/motion.conf
Change to
width 640
width 480
webcontrol_localhost off
stream_localhost off
6. Run motion
Enter the command sudo motion to start running, and press Ctrl+C to exit.
7. LAN web view
Enter the address of the Raspberry Pi on the PC . The viewing port for a single camera is 8081 , and the port for multiple cameras or configuration is 8080.
8. External network (wide area network) web view
You need a public IP , set up DDNS , and set up the router. There are two ways to set it up: one is to set the IP address of the Raspberry Pi to the DMZ host, and the other is to map the IP address of the Raspberry Pi to a port. I won't go into detail here.