User Tools

This is an old revision of the document!


source : linux magazine France n°192 (april 2016)

Install v4l2loop

Source code

apt-get install v4l2loopback-dkms v4l2loopback-utils

Load the driver

sudo modprobe v4l2loopback devices=1 video_nr=1 card_label=toto

Permanently load the driver

/etc/modules-load.d/v4l2loopback.conf

v4l2loopback
/etc/modprobe.d/v4l2loopback.conf
v4l2loopback devices=1 video_nr=1 card_label=toto

Get driver infos

v4l2-ctl --list-devices
v4l2-dbg --info --device=/dev/video1
v4l2-ctl --list-formats --device=/dev/video1

Change settings

v4l2-ctl set-fps 25 /dev/video1

Send video

Exemple using a webcam

ffmpeg -f mjpeg -i http://webcam.st-malo.com/axis-cgi/mjpg/video.cgi?resolution=352x288 -pix_fmt yuv420p -f v4l2 /dev/video1

Read the video

Use vlc or ffplay

ffplay -f v4l2 -i /dev/video1

Capture

ffmpeg -f v4l2 -i /dev/video1 -f mjpeg ./video-capture

Use with chrome

Load the driver

modproble v4l2loopback device=1 video_nr=1 exclusive_cap=1

Inject with gstreamer

gst-launch-0.10 -v videotestsrc ! "video/x-raw-yuv, width=640,height=360, framerate=30/1, format=(fourcc)I420" ! v4l2sink device=/dev/video1
Test with http://opentokrtc.com or http://apprtc.appspot.com

Use with skype

gst-launch videotestsrc ! ffmpegcolorspace ! "video/x-raw-yuv, format=(fourcc)YUV2" ! v4l2sink device=/dev/video1

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information