Skip to content

Instantly share code, notes, and snippets.

@kshaa
Created October 15, 2021 20:58
Show Gist options
  • Save kshaa/3c0b8de502ad84b26e3eb8452d90b755 to your computer and use it in GitHub Desktop.
Save kshaa/3c0b8de502ad84b26e3eb8452d90b755 to your computer and use it in GitHub Desktop.
How to stream WebCam stream in OGG format with VLC over HTTP
@kshaa
Copy link
Author

kshaa commented Mar 8, 2022

Works also on Raspberry Pi's w/ Ubuntu, but it seems that a Pi-specific VLC distribution is needed, i.e.:

sudo apt-get install -y v4l-utils
sudo snap install --edge --devmode vlc-pi
sudo usermod -a -G video $USER
vlc-pi v4l2:// :v4l2-standard=1 :v4l2-dev=/dev/video0 :v4l2-width=640 :v4l2-height=480 :sout="#transcode{vcodec=theo,vb=64,acodec=vorb,ab=64,channels=2,samplerate=44100}:http{dst=:8081/webcam.ogg}" -I dummy 

Note: Audio device didn't seem to work though

@kshaa
Copy link
Author

kshaa commented Mar 10, 2022

One can also take screenshots of the stream by running:

vlc http://localhost:8081/webcam.ogg --rate=1 --video-filter=scene --vout=dummy --aout=dummy --scene-format=png --scene-ratio=24 --scene-prefix=snap --scene-path=/tmp/ vlc://quit

Note: You have to manually kill this process afterwards to make it stop, because --start-time=10 --stop-time=11 (which is typically used for video stream length limiting) is meant for static videos not live streams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment