Skip to content

Instantly share code, notes, and snippets.

@cardboardcode
Last active September 7, 2026 06:09
Show Gist options
  • Select an option

  • Save cardboardcode/c4eca3678d14b255ba84518b3f023289 to your computer and use it in GitHub Desktop.

Select an option

Save cardboardcode/c4eca3678d14b255ba84518b3f023289 to your computer and use it in GitHub Desktop.
For People In A Hurry: How To Set Up mjpg-streamer
image

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.

Instruction(s) ๐Ÿ“˜

  1. Download mpjg-streamer:
git clone https://github.com/jacksonliam/mjpg-streamer --branch v1.0.0 --single-branch --depth 1 && cd mjpg-streamer
  1. Build using the commands below:
cd mjpg-streamer-experimental && make && sudo make install
  1. Plug in your USB web camera physically into your edge device.

  2. Determine the available resolution using the command below:

v4l2-ctl --list-formats-ext

Note

You should see a terminal output similar to what is shown below:

ioctl: VIDIOC_ENUM_FMT
Type: 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)
  ...
  1. 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_MOUNT refers to /dev/video mount point.
  • FRAME_WIDTH refers to the integer on the left hand side.
  • FRAME_HEIGHT refers to the integer on the right hand side.
  • FPS refers to the fps value.
  • PORT_NO refers 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"
  1. 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

http://localhost:8080/?action=stream

Reference(s) ๐Ÿ“š

  1. jacksonliam/mjpg-streamer - https://github.com/jacksonliam/mjpg-streamer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment