Use VLC to play camera with different formats
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):
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. Check my previous post to find out all available output format of camera.
Okay, let say we want to play camera in H264 format,
$ vlc v4l2:///dev/video0:chroma=h264
Make sure, that H264 format is supported by camera through camera built-in encoder; otherwise, it will not play.
To play in MJPG format,
$ vlc v4l2:///dev/video0:chroma=mjpg
You can also specify width and height for video,
$ vlc v4l2:///dev/video0:chroma=mjpg --v4l2-width 800 --v4l2-height 600
or make it with shorthand syntax,
$ vlc v4l2:///dev/video0:chroma=mjpg:width=1280:height=720
Have fun :)
For more tutorials, please visit: http://blog.petehouston.com/