Skip to content
wicking edited this page Feb 26, 2013 · 7 revisions

playing back v4l2loopback devices using MPlayer

producer

again a dummy producer, using gstreamer
gst-launch -v videotestsrc ! "video/x-raw-yuv,width=640,height=360,framerate=30/1,format=(fourcc)I420" ! v4l2sink device=/dev/video1

consumer

minimal mplayer playback mplayer tv:// -tv device=/dev/video1

feeding the pipe with MPlayer's "v4l2" output module

It seems like MPlayer's "v4l2" output module is really only meant for MPEG-decoders. It doesn't support uncompressed video, which is what v4l2loopback is using.

feeding the pipe with MPlayer's "yuv4mpeg" output module

In order to feed the loopback device with MPlayer's "yuv4mpeg" output module, you will need an intermediate program, that pushes the yuv4mpeg stream into the v4l2 device. An example for such a module can be found in the examples/ directory; it's called yuv4mpeg_to_v4l2 and is courtesy by Eric Cooper.

producer

mkfifo /tmp/pipe
./yuv4mpeg_to_v4l2 < /tmp/pipe &
mplayer movie.mp4 -vo yuv4mpeg:file=/tmp/pipe

flash webcam

To make it work with flash webcam you have to change in the examples/yuv4mpeg_to_v4l2.c the line

v.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;

to

v.fmt.pix.pixelformat = V4L2_PIX_FMT_YVU420;

and then use the producer above (mplayer with yuv4mpeg).

This was mentioned in https://github.com/umlaeute/v4l2loopback/issues/8

Clone this wiki locally