I made this script for streaming an usb webcam to mjpeg suitable for OctoPrint on a mac, but it will probably work on linux and windows too. Tested on python 3.7 ...