linux mjpg-streamer installation

mjpg-streamer is a command line application that can copy JPEG frames from one or more input plugins to multiple output plugins.
It can be used to stream JPEG files from webcams to various types of viewers, such as Chrome, Firefox, Cambozola, VLC, mplayer, and other software capable of receiving MJPG streams through an IP-based network.

It was originally written for embedded devices with very limited RAM and CPU resources. Its predecessor "uvc_streamer" was created because a Linux-UVC compatible camera directly generates JPEG data, even from an embedded device running OpenWRT, it can also achieve fast, high-performance M-JPEG streaming. The input module "input_uvc.so" captures such JPG frames from the connected webcam. mjpg-streamer now supports many different input devices.

  1. Clone the source code
eric@eric-PC:~/Documents/linux-c$ git clone https://gitee.com/hainan89/mjpg-streamer.git
正克隆到 'mjpg-streamer'...
remote: Enumerating objects: 2902, done.
remote: Counting objects: 100% (2902/2902), done.
remote: Compressing objects: 100% (1030/1030), done.
remote: Total 2902 (delta 1844), reused 2902 (delta 1844), pack-reused 0
接收对象中: 100% (2902/2902), 3.46 MiB | 969.00 KiB/s, 完成.
处理 delta 中: 100% (1844/1844), 完成.

  • Installation dependency libjpeg8-dev, gcc, g++
eric@eric-PC:~/Documents/linux-c$ sudo apt-get install cmake libjpeg8-dev
eric@eric-PC:~/Documents/linux-c$ sudo apt-get install gcc g++
  • Enter mjpg-streamer/mjpg-streamer-experimental, if make
    prompts error:'CV_IMWRITE_JPEG_QUALITY' was not declared in this scope, then manually add the definition
    file:mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv.cpp
// eric++
#define CV_IMWRITE_JPEG_QUALITY 1
#define CV_IMWRITE_PNG_COMPRESSION 16
#define CV_IMWRITE_PXM_BINARY 32
// eric<<
eric@eric-PC:~/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental$ ls
cmake           Dockerfile       LICENSE     Makefile         mjpg_streamer.h         plugins         README.md  start.sh  utils.c  www
CMakeLists.txt  docker-start.sh  makedeb.sh  mjpg_streamer.c  [email protected]  postinstall.sh  scripts    TODO      utils.h
eric@eric-PC:~/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental$ 
eric@eric-PC:~/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental$ 
eric@eric-PC:~/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental$ make
...
[100%] Linking C shared library output_udp.so
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
make[3]: 离开目录“/home/eric/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental/_build”
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
[100%] Built target output_udp
make[2]: 离开目录“/home/eric/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental/_build”
/usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
make[1]: 离开目录“/home/eric/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental/_build”
  • Install
eric@eric-PC:~/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental$ sudo make install
  • Start mjpeg-streamer
eric@eric-PC:~/Documents/linux-c/mjpg-streamer/mjpg-streamer-experimental$ ./start.sh 
MJPG Streamer Version: git rev: 501f6362c5afddcfb41055f97ae484252c85c912
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: -1
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
 o: www-folder-path......: ./www/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: enabled
 i: select() timeout
 i: cleaning up resources allocated by input thread

  • Test: enter http://localhost:8080 in the browser
    Insert picture description here

Guess you like

Origin blog.csdn.net/pyt1234567890/article/details/109559260