Skip to content

Instantly share code, notes, and snippets.

@poulou0
Last active September 23, 2022 07:18
Show Gist options
  • Save poulou0/06dc75cf28aca764e2ceb75710aa2cf9 to your computer and use it in GitHub Desktop.
Save poulou0/06dc75cf28aca764e2ceb75710aa2cf9 to your computer and use it in GitHub Desktop.
mjpg-streamer notes

mjpg-streamer

Install

sudo apt-get install cmake libjpeg62-turbo-dev gcc g++ && \
cd ~ && \
git clone https://github.com/jacksonliam/mjpg-streamer && \
cd mjpg-streamer/mjpg-streamer-experimental/ && \
make && sudo make install && \
printf '[Unit]\nDescription=Start mjpeg-streamer on startup.\nAfter=multi-user.target\n\n[Service]\nType=simple\nExecStart=/usr/local/bin/mjpg_streamer -o "output_http.so -w ./www" -i "input_uvc.so"\nExecStop=/usr/bin/killall mjpg_streamer\n\n[Install]\nWantedBy=multi-user.target\n' | sudo tee /etc/systemd/system/mjpeg-streamer.service && \
sudo systemctl enable mjpeg-streamer.service && sudo systemctl start mjpeg-streamer.service

Use

  • http://[ip]:8080/?action=stream
  • http://[ip]:8080/?action=snapshot

Tweak

Change the resolution

  1. Find the supported resolutions with: v4l2-ctl -d /dev/video0 --list-formats-ext
  2. Change it on the service
    sudo nano /etc/systemd/system/mjpeg-streamer.service
    
    ....
    ExecStart=/usr/local/bin/mjpg_streamer -o "output_http.so -w ./www" -i "input_uvc.so -r 640x480"
    ....
    
  3. Reload and restart the service
    sudo systemctl daemon-reload && sudo systemctl restart mjpeg-streamer.service
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment