Note
This is a quick copy-paste-observe guide that shows you how to set up and run a mjpg-streamer. This allows you to easily have a web camera video stream available within a LAN.
- Download
mpjg-streamer:
git clone https://github.com/jacksonliam/mjpg-streamer --branch v1.0.0 --single-branch --depth 1 && cd mjpg-streamer- Build using the commands below:
cd mjpg-streamer-experimental && make && sudo make install-
Plug in your USB web camera physically into your edge device.
-
Determine the available resolution using the command below:
v4l2-ctl --list-formats-extNote
You should see a terminal output similar to what is shown below:
ioctl: VIDIOC_ENUM_FMTType: Video Capture
[0]: 'MJPG' (Motion-JPEG, compressed)
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x1024
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x960
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
...
- Run
mjpg_streamer:
#Eg.
./mjpg_streamer \
-i "./input_uvc.so -d /dev/<DEVICE_MOUNT> -r <FRAME_WIDTH>x<FRAME_HEIGHT> -f <FPS>" \
-o "./output_http.so -w ./www -p <PORT_NO>"DEVICE_MOUNTrefers to/dev/videomount point.FRAME_WIDTHrefers to the integer on the left hand side.FRAME_HEIGHTrefers to the integer on the right hand side.FPSrefers to thefpsvalue.PORT_NOrefers to the port the user intends to expose the video stream on.
#Eg.
./mjpg_streamer \
-i "./input_uvc.so -d /dev/video0 -r 1280x720 -f 30" \
-o "./output_http.so -w ./www -p 8080"- Access the video stream via the link below:
http://<IP_ADDRESS>:8080/?action=stream
IP_ADDRESS refers to the IP address of the edge device in question.
Tip
Run
export WIFI_IP=$(hostname -I | awk '{print $1}')
echo $WIFI_IP- jacksonliam/mjpg-streamer - https://github.com/jacksonliam/mjpg-streamer