For detailed information, please refer to Section 3.13.6 of the “OrangePi_Zero2_H616_User_Manual_v4.0.pdf” regarding USB camera testing.
Steps are as follows:
1.First, plug the USB camera into the USB port of the Orange Pi development board.2.Then, use the lsmod command to see that the kernel has automatically loaded the following module:
orangepi@orangepi:~$ lsmod | grep uvcvideo | grep -v grep
uvcvideo 106496 0
3) Using the v4l2-ctl command, you can see that the device node information for the USB camera is /dev/videox (x could be 0, 1, or 2, etc.).
orangepi@orangepi:~$ sudo apt update
orangepi@orangepi:~$ sudo apt install -y v4l-utils
orangepi@orangepi:~$ v4l2-ctl --list-devices
USB 2.0 Camera (usb-sunxi-ehci-1): /dev/video1
Note: The letter ‘l’ in v4l2 is lowercase, not the number ‘1’.
Additionally, the number for video may not always be video1, please refer to what you actually see.
4) Test the USB camera using fswebcam.
a. Install fswebcam:
orangepi@orangepi:~$ sudo apt update
orangepi@orangepi:~$ sudo apt-get install -y fswebcam
b. After installing fswebcam, you can use the following command to take a photo:
a) The -d option is used to specify the device node of the USB camera.
b) The –no-banner option is used to remove the watermark from the photo.
c) The -r option is used to specify the resolution of the photo.
d) The -S option is used to skip a specified number of frames.
e) ./image.jpg is used to set the name and path of the generated photo.
orangepi@orangepi:~$ sudo fswebcam -d /dev/video1 --no-banner -r 1280x720 -S 5 ./image.jpg # Note: here, video1 should be modified according to the actual situation.
c. In the server version of the Linux system, after taking a photo, you can directly drag it to your computer desktop using mobaxterm or use the scp command to transfer the taken image to your Ubuntu PC for viewing:
orangepi@orangepi:~$ scp image.jpg [email protected]:/home/pg/ # Modify pg to your actual home directory user name.
1.Test the USB camera using mjpg-streamer:
a. Download mjpg-streamer:
orangepi@orangepi:~$ git clone https://github.com/jacksonliam/mjpg-streamer
b) The Gitee mirror download address is:
orangepi@orangepi:~$ git clone https://gitee.com/leeboby/mjpg-streamer
b. Install the required software packages:
orangepi@orangepi:~$ sudo apt-get install -y cmake libjpeg8-dev
c. Compile and install mjpg-streamer:
orangepi@orangepi:~$ cd mjpg-streamer/mjpg-streamer-experimental
orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ make -j4
orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ sudo make install
d. Then enter the following command to start mjpg_streamer:
Note: The number for video may not always be video1, please refer to what you actually see.
orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ export LD_LIBRARY_PATH=.
orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$sudo ./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -u -f 30" -o "./output_http.so -w ./www"
e. Then, in a web browser on a PC or mobile device that is on the same local network as the development board, enter 【The IP address of the development board:8080】 to see the video output from the camera.
f. It is recommended to use mjpg-streamer to test the USB camera as it is much smoother than motion, and you won’t feel any lag when using mjpg-streamer.
g. Modify the start.sh script, changing the:
./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
to:
./mjpg_streamer -i "./input_uvc.so -d /dev/video1 -u -f 30" -o "./output_http.so -w ./www" # Note: here, video1 needs to be modified according to the actual situation.
Then you can run the camera by executing ./start.sh.