Download, Installation and Setup

Download

Download is straightforward, just download the gzipped tar archive using the download menu entry on the left.

You may want to verify the SHA256 checksum, this is done as follows:

$ sha256sum Inlab-MJPG-Streamer-0.1.42.tar.gz
243b408c22833c4179fe1bd43d7bff2488e9c51fda3c3a7ebc0c4572b425432b  Inlab-MJPG-Streamer-0.1.42.tar.gz
$

Installation

The tar archive contains two binaries, one for Linux x86 64Bit and the other for Raspbian ARM 32Bit (Raspberry Pi):

$ tar tvfz Inlab-MJPG-Streamer-0.1.42.tar.gz
drwxrwxr-x t/t               0 2021-04-07 16:21 Inlab-MJPG-Streamer-0.1.42/
-rw-rw-r-- t/t            6140 2021-04-07 16:21 Inlab-MJPG-Streamer-0.1.42/_LICENSE.txt
drwxrwxr-x t/t               0 2021-04-07 16:16 Inlab-MJPG-Streamer-0.1.42/ARM32/
-rwxr-xr-x t/t          364160 2021-04-07 16:16 Inlab-MJPG-Streamer-0.1.42/ARM32/streamer
drwxrwxr-x t/t               0 2021-04-07 16:15 Inlab-MJPG-Streamer-0.1.42/X8664/
-rwxrwxr-x t/t          784616 2021-04-07 16:15 Inlab-MJPG-Streamer-0.1.42/X8664/streamer
$

Just pick the streamer binary for your platform and move or copy it to any desired location.

If the binary name streamer conflicts with any pre-existing program with the same name, it’s absolutely safe to change it to anything else (for example inlab-streamer, just to give you an idea).

Adding the operating User to Group “video”

It’s generally a good idea not to run Inlab-MJPG-Streamer as root, but as a user which has the necessary access rights for the /dev/video devices. They usually are accessible for all users which belong to the group video.

Adding a user to group video can be done safely with the usermod command.

Example (adding the currently active user):

sudo usermod -a -G video $LOGNAME

The default user pi on the Raspberry Pi is already member of group video by default. If you are running Inlab-MJPG-Streamer as this user, there’s nothing to do here.

Obtaining Camera Informations

Displaying available v4l2 Devices

The command v4l2-ctl –list-devices shows you all available v4l2 devices available.

Example:

$ v4l2-ctl --list-devices
HD USB Camera: HD USB Camera (usb-0000:00:14.0-2):
	/dev/video0
	/dev/video1
	/dev/media0

Chicony USB 2.0 Camera: Chicony (usb-0000:00:14.0-6):
	/dev/video2
	/dev/video3
	/dev/media1

Usually the first device name is what you need to access the camera (/dev/video0 and /dev/video2 in this example).

List available formats for a specific camera

The command v4l2-ctl –list-formats-ext -d<&lt>device> lists all available formats for a specific device.

Example:

$ v4l2-ctl --list-formats-ext -d/dev/video2
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'YUYV' (YUYV 4:2:2)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 160x120
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 176x144
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 352x288
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.100s (10.000 fps)
		Size: Discrete 640x360
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
	[1]: 'MJPG' (Motion-JPEG, compressed)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 160x120
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 176x144
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 352x288
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 640x360
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.067s (15.000 fps)

MJPG and YUYV are both supported by Inlab-MJPG-Streamer, so the example above is just fine. If you see only JPEG entries instead, the camera is an older model and not supported (just proceed with a more recent model).

Some additional Notes for Raspberry Pi

It’s important to have a recent Raspbian release installed where v4l2 is already included.

Using the Raspberry Pi Camera

If you intend to access your Raspberry Pi camera module with v4l2, you need to execute the following step:

sudo modprobe bcm2835-v4l2

To load this module on reboot add the following line to /etc/modules:

bcm2835-v4l2

Loading the uvcvideo Module with quirks=0x80

If you experience select()-warning errors with your USB webcam on the Raspberry Pi, most likely the quirks=0x80 setting for the uvcvideo module helps. Here are the proposed steps:

rmmod uvcvideo
modprobe uvcvideo nodrop=1 timeout=5000 quirks=0x80

To make this setting active on reboot, just add the file /etc/modprobe.d/uvcvideo.conf with the following contents:

options uvcvideo nodrop=1 timeout=5000 quirks=0x80

I’m not 100% sure if nodrop=1 timeout=5000 is really necessary, but this is how it works with our Raspberry Pis.

Changing the default.target (disabling/enabling the GUI)

This command shows the current default boot behaviour in the first line of its output (Id=multi-user.target stands for command line/textual, if you see Id=graphical.target your Raspberry Pi starts with the GUI):

systemctl show default.target

To enable command line / textual mode you need to enter this:

sudo systemctl set-default multi-user.target

GUI mode is enabled with this command:

sudo systemctl set-default graphical.target

Any changes are in effect after a reboot, for example with this command:

sudo init 6

Starting automatically at Reboot

In order to start Inlab-MJPG-Streamer automatically on reboot, we recommend to configure this with cron. This is a very simple and stable method that very often is just overlooked.

Just edit with “crontab -e” as a user in group video its crontab file and add a line as follows (with additional options as desired). Just don’t forget the -b option for starting streamer as a daemon process:

@reboot sleep 30; /sbin/streamer -b

The location of the streamer binary needs to be valid (it’s there where you have put it before). The “sleep 30” makes sure that all network configuration is set up and ready before Inlab-MJPG-Streamer starts.