Linux Webcam Streamer

Install utilities

apt-get install v4l-utils

Show which formats are available on the camera

v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUYV 4:2:2

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'H264' (compressed)
        Name        : H.264

        Index       : 2
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : Motion-JPEG

Serve the MJPG video format over TCP

cvlc --no-audio v4l2:///dev/video0 --v4l2-chroma MJPG  --sout '#standard{access=http,mux=mpjpeg,dst=:8080/}' -I dummy

To run while a root user (ie, within rc.local or using kali)

runuser -l pi -c '/home/pi/streammjpeg'

Leave a Reply

Your email address will not be published. Required fields are marked *