Giter VIP home page Giter VIP logo

picam's Introduction

picam

Experimental project for building a desktop webcam using raspberry pi with a camera module

Reference Tools

  1. See how V4L2Loop is created (from droidcam) https://github.com/aramg/droidcam/tree/master/linux
  2. Wiki on v4l2loop devices are created and loaded https://github.com/umlaeute/v4l2loopback
  3. Examples on writing to V4L2loop device using FFmpeg https://github.com/umlaeute/v4l2loopback/wiki/FFmpeg

Using the Raspberry PI camera as a network webcam

Your boss wants you in a webex but you have no camera available, but a raspberrypi + camera module (CSI)? No problem. Build up a network webcam in a minute. With ffmpeg + v4l2loopback.

Bring the raspberrypi camera on track (Camera server) To stream the camera data (raw h264 stream, 1280x720 and 1MBit/s) over network just use the raspivid command:

raspivid -t 0 -hf -fps 30 -w 1280 -h 720 -b 1000000 -l -o tcp://0.0.0.0:5000 So, a tcp server is now ready to deliver our data. If you do not want to limit the h264 data bandwidth, just omit the -b parameter.

Bring up ffmpeg with v4l2loopback (Client which receives video feed) v4l2loopback config First, you need to get your /dev/video0 device up which is accepted by firefox:

modprobe v4l2loopback devices=1 max_buffers=2 exclusive_caps=1 card_label="VirtualCam #0" Be sure to run this command as root. Otherwise no kernel module can be loaded.

ffmpeg stream start Now comes the final step. We will receive the stream from network and writing it into the /dev/video0 device:

ffmpeg -f h264 -i tcp://RASPICAM:5000 -f v4l2 -pix_fmt yuv420p /dev/video0 Set RASPICAM to your hostname/ip of the raspberrypi with the camera.

BONUS: Let your graphics card do the hard work (NVIDIA with VDPAU) To offload h264 graphics decoding to your graphics card via VDPAU you can do this:

ffmpeg -f h264 -hwaccel vdpau -i tcp://goldeneye:5000 -f v4l2 -pix_fmt yuv420p /dev/video0 Your graphics card will now do the hard work. Check in top/htop if you have less load on your ffmpeg task.

Instead of Network based

picam's People

Contributors

wiless avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.