Skip to content

Latest commit

 

History

History
 
 

examples

v4l2loopback tests
==================

test
----

this small sample application will write an image into a v4l2loopback device.
the image will be 640x480 pixels in UYVY colorspace (and since all pixels are
set to "0" it will be green).
the video-device defaults to /dev/video1 but you can specify another device on
the commandline

USAGE:
$ make test
$ ./test /dev/video2 &
$ xawtv -c /dev/video2

if you want to use another device you need to modify the VIDEO_DEVICE define at
the beginning of the code and recompile.

yuv4mpeg_to_v4l2
----------------
Copyright (C) 2011  Eric C. Cooper <[email protected]>

Example using mplayer as a producer for the v4l2loopback driver:

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

ondemandcam
-----------
Copyright 2015, [email protected], GPLv3.
This will wait until something connects to pull frames then sends them.
It uses two threads and semaphores to do the testing.
It can setup and teardown the frame source.
The example just sends a different color each second.
It is 80x60 (it is a skeleton for hardware with this resolution)

$ make ondemandcam
$ ondemandcam /dev/videoX & # where X is the v4l2loopback device

It can be viewed with:

$ vlc v4l2:///dev/videoX # X is same device as above

yuv420_infiniteloop
-------------------

A simple example for looping over frames of a raw yuv420 video file without
bothering other video players. Download and unzip an example sequence
akiyo_qcif.yuv from [here](http://trace.eas.asu.edu/yuv/akiyo/akiyo_qcif.7z).

Usage
$ make yuv420_infiniteloop
$ ./yuv420_infiniteloop devicename yuvpath width height fps

Example with akiyo_qcif.yuv, width 176, height 144 and fps 30:

$ make yuv420_infiniteloop
$ ./yuv420_infiniteloop /dev/video1 akiyo_qcif.yuv 176 144 30

It can be viewed with:
$ ffplay devicename

The YUV format is for raw sequences, more samples can be obtained
from [here](http://trace.eas.asu.edu/yuv/). And they can be created using
ffmpeg like this:

$ ffmpeg -i inputfile.mp4 -c:v rawvideo outputfile.yuv

More details can be found in [ffmpeg wiki](https://github.com/stoyanovgeorge/ffmpeg/wiki/Encode-Raw-Video).