Skip to content

A demo illustrating capturing video using v4l2 and displaying with SDL2

License

Notifications You must be signed in to change notification settings

chendotjs/Webcam-SDL2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webcam-SDL2

Build Status

Intro

This is a simple example which illustrates how to capture video(or image if you like) using v4l2 and to display with SDL2.

Currently, most webcams supports YUYV422 output format. So the default output format is set to YUYV422. You can modify the format parameter both for v2lc and sdl2 to be compatible with your webcam.

To list support formats of your webcam, try following commands:

v4l2-ctl --list-formats-ext

or if ffmpeg installed

ffmpeg -f v4l2 -list_formats all -i /dev/video0

Usage

Both Makefile and CMakeLists are provided.

  • using Makefile
git clone https://github.com/chendotjs/Webcam-SDL2
cd Webcam-SDL2/src
sudo apt-get install libsdl2-dev
make
./simple_cam 640 480 /dev/video0
  • using CMakeLists
git clone https://github.com/chendotjs/Webcam-SDL2
cd Webcam-SDL2/
sudo apt-get install libsdl2-dev
mkdir build && cd build
cmake ../src
make
./simple_cam 640 480 /dev/video0

References

fswebcam

CAPTURING A WEBCAM STREAM USING V4L2

最简单的视音频播放示例1:总述

About

A demo illustrating capturing video using v4l2 and displaying with SDL2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published