broadcasting opencv output video with mjpg streamer in python
For use this project need to install mjpg-streamer and run it on linux terminal
Following this steps
sudo apt-get install libjpeg8-dev imagemagick libv4l-dev
sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
unzip mjpg-streamer-code-182.zip
cd mjpg-streamer-code-182/mjpg-streamer
make mjpg_streamer input_file.so output_http.so
sudo cp mjpg_streamer /usr/local/bin
sudo cp output_http.so input_file.so /usr/local/lib/
sudo cp -R www /usr/local/www
python main.py
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /path/to/your/save/jpg/file -n pic.jpg" -o "output_http.so -w /usr/local/www"
Example :
LD_LIBRARY_PATH=/usr/local/lib/ mjpg_streamer -i "input_file.so -f /home/mazyar/Desktop -n out.jpg" -o "output_http.so -w /usr/local/www"
Now you can connect with your web browser and watch the stream live. If you want to watch
from within the same Raspberry Pi you can enter http://localhost:8080 in the browser's
address bar. If you want to watch from another computer in your network use
http://IP-address:8080.