One of very common task working with webcam is to streaming it to web via HTTP. There are many ways to do it, and I will tell you how to do with VLC.
First is to make sure the webcam is connected and playing well, confirm it by,
$ vlc v4l2:///dev/video0
If you see the webcam playing on VLC, it works fine.
In VLC, to make an output stream, you will need to out –sout option with specified output module. Since we are trying to streaming out to HTTP, we will use std module with access option set to http, along with mpjpeg muxer. So, the command will be,
$ vlc v4l2:///dev/video0 --sout ‘#std{access=http,mux=mpjpeg,dst=IP:PORT}’
To confirm the output stream,
$ vlc http://IP:PORT
Well, up to this point, it just might work well for several cameras, not all. The reason is that default streaming output format from webcam often being YUYV as I mentioned in previous article.
To solve this, we can just apply the transcode module from VLC,
$ vlc v4l2:///dev/video0 --sout ‘#transcode{vcodec=mjpg}:std{access=http,mux=mpjpeg,dst=IP:PORT}’
Try to play the HTTP stream again, it should work. To make the output HTTP stream to be able to be played via web HTML5 video, MIME should be present,
$ vlc v4l2:///dev/video0 --sout ‘#transcode{vcodec=mjpg}:std{access=http{mime=multipart/x-mixed-replace;boundary=-7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=IP:PORT}’
To enable GPU (hardware-acceleration), use the chroma= option as I mentioned before.
$ vlc v4l2:///dev/video0:chroma=mjpg --sout ‘#std{access=http{mime=multipart/x-mixed-replace;boundary=-7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=IP:PORT}’
Have fun 🙂
Original post: http://blog.petehouston.com/2015/12/21/streaming-webcam-to-http-using-vlc/
For more tutorials, please visit: http://blog.petehouston.com/
Code / Design / Love @ https://petehouston.com
Dec 23, 2015
To force hardware-acceleration, which makes use of GPU, while playing or streaming from webcam, we need to add chroma= option to the input device. For example, if I want to force GPU for H264 codec on /dev/video0 device.
$ vlc v4l2:///dev/video0:chroma=h264
The value of chroma option is the codec, or pixelformat, supported by the webcam. So you need to check what output format supported by camera beforehand.
Original post: http://blog.petehouston.com/2015/12/21/force-hardware-acceleration-on-vlc-playing-from-webcam/
For more tutorials, please visit: http://blog.petehouston.com/
Dec 23, 2015
Streaming connected camera to RTSP using VLC is pretty much easy,
$ vlc v4l2:///dev/video0 --sout ‘#rtp{mux=ts,sdp=rtsp://IP:PORT/cam.sdp}’
Make sure to have camera plugged into the computer or host.
rtp — is the name of the VLC module we will use to stream to RTSP.
mux=ts — this is multiplex format, for live streaming, it should be ts.
sdp=rtsp://IP:PORT/cam.sdp — specify the output SDP on RTSP.
To play this RTSP stream,
$ vlc rtsp://IP:PORT/cam.sdp
Have fun 🙂
Original post: http://blog.petehouston.com/2015/12/21/streaming-camera-to-rtsp-using-vlc/
For more tutorials, please visit: http://blog.petehouston.com/
1
Dec 23, 2015
Sometimes, you don’t want to play audio from the input, you can disable it easily via command-line by adding the option –no-audio,
$ vlc video.mp4 — no-audio
Specifically, it is useful for playing from camera, you don’t need sound and want to make an output for streaming, such as RTSP…you will need to add acodec=none to the transcode module.
$ vlc v4l2:///dev/video0 --sout ‘#transcode{acodec=none,vcodec=h264}:rtp{mux=ts,sdp=rtsp://IP:PORT/cam.sdp}’
That’s it, VLC will remove audio stream while streaming.
Original post: http://blog.petehouston.com/2015/12/21/disable-audio-when-playing-or-streaming-video-with-vlc/
To view the camera connected to the computer, you can use VLC to play it with V4L2 driver.
$ vlc v4l2://
Since we don’t provide a explicit device name, VLC will look for the first available camera device, which is usually /dev/video0. If there are more connected devices, you should provide the device to play. Check the list of available device by issuing this command,
$ v4l2-ctl --list-devices
HD Pro Webcam C920 (usb-0000:00:1a.0–1.3):
/dev/video0
and to play,
$ vlc v4l2:///dev/video0
While playing VLC will try to determine which is default supported format of camera, which is usually, YUYV. …
Read more · 1 min read
v4l-utils is a popular package that helps manipulate and control video device on Linux. Install this package on Debian-based distros is pretty much easy.
$ sudo apt-get update$ sudo apt-get install v4l-utils
After installation, some of v4l2 utilities should be available to use, you can confirm by issuing the following command,
$ v4l2-ctl General/Common options: — all display all information available -C, — get-ctrl=<ctrl>[,<ctrl>…] get the value of the controls [VIDIOC_G_EXT_CTRLS] -c, — set-ctrl=<ctrl>=<val>[,<ctrl>=<val>…] set the value of the controls [VIDIOC_S_EXT_CTRLS] -D, — info show driver info [VIDIOC_QUERYCAP] -d, — device=<dev> use device <dev> instead of /dev/video0 if <dev>…
Source: Streaming webcam to HTTP using VLC | by Pete Houston | Medium