【BIGTREETECH PI development board】 mjpg-streamer video camera
[Copy link]
This post was last edited by TL-LED on 2023-7-6 17:45
In this article, we will learn how to use mjpg-streamer to implement a web surveillance camera on the BIGTREETECH PI development board using a USB camera.
1. USB Camera
View USB Camera Devices
Video0 device detected
2. Install the software
2.1. Download mjpg-streamer
biqu@BTT-CB1:/home$ sudo git clone
2.2. Install dependent packages
biqu@BTT-CB1:/home$ sudo apt-get install -y cmake libjpeg62-turbo-dev
2.3 Compilation
biqu@BTT-CB1:/home/mjpg-streamer/mjpg-streamer-experimental$ sudo make
biqu@BTT-CB1:/home$ cd mjpg-streamer/mjpg-streamer-experimental/
biqu@BTT-CB1:/home/mjpg-streamer/mjpg-streamer-experimental$ sudo make
[ -d _build ] || mkdir _build
[ -f _build/Makefile ] || (cd _build && cmake -DCMAKE_BUILD_TYPE=Release ..)
-- The C compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMAKE_BUILD_TYPE = Release
-- Looking for include file sys/inotify.h
-- Looking for include file sys/inotify.h - found
CMake Warning at plugins/input_opencv/CMakeLists.txt:4 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (Gphoto2). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/share/cmake-3.18/Modules/FindPkgConfig.cmake:59 (find_package_handle_standard_args)
cmake/FindGphoto2.cmake:21 (include)
plugins/input_ptp2/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'libgphoto2'
-- No package 'libgphoto2' found
CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
The package name passed to `find_package_handle_standard_args` (GPHOTO2)
does not match the name of the calling package (Gphoto2). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake/FindGphoto2.cmake:44 (find_package_handle_standard_args)
plugins/input_ptp2/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Could NOT find GPHOTO2 (missing: GPHOTO2_LIBRARY GPHOTO2_INCLUDE_DIR)
-- Looking for include file linux/videodev2.h
-- Looking for include file linux/videodev2.h - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Could NOT find SDL (missing: SDL_LIBRARY SDL_INCLUDE_DIR)
-- Could NOT find protobuf-c (missing: PROTOBUF_C_LIBRARY PROTOBUF_C_INCLUDE_DIR)
-- The following features have been enabled:
* PLUGIN_INPUT_FILE, File input plugin
* PLUGIN_INPUT_HTTP, HTTP input proxy plugin
* PLUGIN_INPUT_UVC, Video 4 Linux input plugin
* PLUGIN_OUTPUT_FILE, File output plugin
* PLUGIN_OUTPUT_HTTP, HTTP server output plugin
* PLUGIN_OUTPUT_RTSP, RTSP output plugin
* PLUGIN_OUTPUT_UDP, UDP output stream plugin
-- The following OPTIONAL packages have been found:
* Threads
-- The following features have been disabled:
* WXP_COMPAT, Enable compatibility with WebcamXP
* PLUGIN_INPUT_OPENCV, OpenCV input plugin (unmet dependencies)
* PLUGIN_INPUT_RASPICAM, Raspberry Pi input camera plugin (unmet dependencies)
* PLUGIN_INPUT_PTP2, PTP2 input plugin (unmet dependencies)
* ENABLE_HTTP_MANAGEMENT, Enable experimental HTTP management option
* PLUGIN_OUTPUT_VIEWER, SDL output viewer plugin (unmet dependencies)
* PLUGIN_OUTPUT_ZMQSERVER, ZMQ Server output plugin (unmet dependencies)
-- The following OPTIONAL packages have not been found:
* OpenCV
* Gphoto2
* SDL
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mjpg-streamer/mjpg-streamer-experimental/_build
make -C _build
make[1]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[2]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target mjpg_streamer
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 4%] Building C object CMakeFiles/mjpg_streamer.dir/mjpg_streamer.c.o
[ 8%] Building C object CMakeFiles/mjpg_streamer.dir/utils.c.o
[ 13%] Linking C executable mjpg_streamer
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 13%] Built target mjpg_streamer
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target input_file
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 17%] Building C object plugins/input_file/CMakeFiles/input_file.dir/input_file.c.o
[ 21%] Linking C shared library input_file.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 21%] Built target input_file
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target input_http
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 26%] Building C object plugins/input_http/CMakeFiles/input_http.dir/input_http.c.o
[ 30%] Building C object plugins/input_http/CMakeFiles/input_http.dir/misc.c.o
[ 34%] Building C object plugins/input_http/CMakeFiles/input_http.dir/mjpg-proxy.c.o
[ 39%] Linking C shared library input_http.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 39%] Built target input_http
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target input_uvc
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 43%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/dynctrl.c.o
[ 47%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/input_uvc.c.o
[ 52%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/jpeg_utils.c.o
[ 56%] Building C object plugins/input_uvc/CMakeFiles/input_uvc.dir/v4l2uvc.c.o
[ 60%] Linking C shared library input_uvc.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 60%] Built target input_uvc
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target output_file
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 65%] Building C object plugins/output_file/CMakeFiles/output_file.dir/output_file.c.o
[ 69%] Linking C shared library output_file.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 69%] Built target output_file
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target output_http
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 73%] Building C object plugins/output_http/CMakeFiles/output_http.dir/httpd.c.o
[ 78%] Building C object plugins/output_http/CMakeFiles/output_http.dir/output_http.c.o
[ 82%] Linking C shared library output_http.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 82%] Built target output_http
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target output_rtsp
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 86%] Building C object plugins/output_rtsp/CMakeFiles/output_rtsp.dir/output_rtsp.c.o
[ 91%] Linking C shared library output_rtsp.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 91%] Built target output_rtsp
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Scanning dependencies of target output_udp
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 95%] Building C object plugins/output_udp/CMakeFiles/output_udp.dir/output_udp.c.o
[100%] Linking C shared library output_udp.so
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[100%] Built target output_udp
make[2]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[1]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
2.4. Installation
biqu@BTT-CB1:/home/mjpg-streamer/mjpg-streamer-experimental$ sudo make install
biqu@BTT-CB1:/home/mjpg-streamer/mjpg-streamer-experimental$ sudo make install
make -C _build install
make[1]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[2]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 13%] Built target mjpg_streamer
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 21%] Built target input_file
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 39%] Built target input_http
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 60%] Built target input_uvc
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 69%] Built target output_file
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 82%] Built target output_http
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[ 91%] Built target output_rtsp
make[3]: Entering directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
make[3]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
[100%] Built target output_udp
make[2]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/bin/mjpg_streamer
-- Set runtime path of "/usr/local/bin/mjpg_streamer" to "/usr/local/lib/mjpg-streamer"
-- Installing: /usr/local/share/mjpg-streamer/www
-- Installing: /usr/local/share/mjpg-streamer/www/static.html
-- Installing: /usr/local/share/mjpg-streamer/www/stream_simple.html
-- Installing: /usr/local/share/mjpg-streamer/www/JQuerySpinBtn.css
-- Installing: /usr/local/share/mjpg-streamer/www/bodybg.gif
-- Installing: /usr/local/share/mjpg-streamer/www/rotateicons.png
-- Installing: /usr/local/share/mjpg-streamer/www/java.html
-- Installing: /usr/local/share/mjpg-streamer/www/static_simple.html
-- Installing: /usr/local/share/mjpg-streamer/www/jquery.js
-- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.core.min.js
-- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.widget.min.js
-- Installing: /usr/local/share/mjpg-streamer/www/control.htm
-- Installing: /usr/local/share/mjpg-streamer/www/sidebarbg.gif
-- Installing: /usr/local/share/mjpg-streamer/www/fix.css
-- Installing: /usr/local/share/mjpg-streamer/www/favicon.png
-- Installing: /usr/local/share/mjpg-streamer/www/index.html
-- Installing: /usr/local/share/mjpg-streamer/www/JQuerySpinBtn.js
-- Installing: /usr/local/share/mjpg-streamer/www/javascript_simple.html
-- Installing: /usr/local/share/mjpg-streamer/www/videolan.html
-- Installing: /usr/local/share/mjpg-streamer/www/LICENSE.txt
-- Installing: /usr/local/share/mjpg-streamer/www/cambozola.jar
-- Installing: /usr/local/share/mjpg-streamer/www/stream.html
-- Installing: /usr/local/share/mjpg-streamer/www/javascript.html
-- Installing: /usr/local/share/mjpg-streamer/www/favicon.ico
-- Installing: /usr/local/share/mjpg-streamer/www/example.jpg
-- Installing: /usr/local/share/mjpg-streamer/www/functions.js
-- Installing: /usr/local/share/mjpg-streamer/www/spinbtn_updn.gif
-- Installing: /usr/local/share/mjpg-streamer/www/java_control.html
-- Installing: /usr/local/share/mjpg-streamer/www/javascript_motiondetection.html
-- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.tabs.min.js
-- Installing: /usr/local/share/mjpg-streamer/www/java_simple.html
-- Installing: /usr/local/share/mjpg-streamer/www/style.css
-- Installing: /usr/local/share/mjpg-streamer/www/jquery.ui.custom.css
-- Installing: /usr/local/share/mjpg-streamer/www/jquery.rotate.js
-- Installing: /usr/local/lib/mjpg-streamer/input_file.so
-- Installing: /usr/local/lib/mjpg-streamer/input_http.so
-- Installing: /usr/local/lib/mjpg-streamer/input_uvc.so
-- Installing: /usr/local/lib/mjpg-streamer/output_file.so
-- Installing: /usr/local/lib/mjpg-streamer/output_http.so
-- Installing: /usr/local/lib/mjpg-streamer/output_rtsp.so
-- Installing: /usr/local/lib/mjpg-streamer/output_udp.so
make[1]: Leaving directory '/home/mjpg-streamer/mjpg-streamer-experimental/_build'
3. Run mjpg-streamer
3.1、Execution
biqu@BTT-CB1:/home/mjpg-streamer/mjpg-streamer-experimental$ sudo /usr/local/bin/mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -y" -o "output_http.so"
3.2、Run ip
Enter the IP address of the development board in the browser: http://192.168.1.107:8080/?action=stream
3.3 Video
110947
|