Giter Club home page Giter Club logo

wcbf's Introduction

What does WCBF do

The program takes input a video stream and outputs a video stream. The even frames are the original frame, and the odd frames are the processed frame with background detected and set to black. Hence WCBF outputs twice as many frames as it reads. The output data can then be piped into tools like ffmpeg for further process and feed into a virtual webcam

Example: Background Blur

Initialize Submodule

git submodule update --init --recursive

Initialize Virtual Camera

sudo modprobe v4l2loopback devices=1 Form now on the example assume webcam is at /dev/video0 and v4l2 device is created at /dev/video1. (Check with v4l2-ctl --list-devices)

Blur

The idea is to

  1. Feed webcam into WCBF
  2. Feed output of WCBF into another ffmpeg
  3. Blur the even frames, transparent the odd frames, finally overlay and output to /dev/video1

So we have three commands chained together. The actual command is shown below. Noted that ffmpeg counts frame starting at one.

ffmpeg -f v4l2 -i /dev/video0 -pix_fmt rgb24 -f rawvideo -r 30 - 2>/dev/null\
    | python3 main.py -s 640x480 -f rgb24 \
    |  ffmpeg -thread_queue_size 32 -f rawvideo -framerate 60 -pix_fmt rgb24 -video_size 640x480 -i -\
    -filter_complex "[0:v]select='mod(n-1\,2)',boxblur=10[a];[0:v]select='not(mod(n-1\,2))',colorkey=0x000000:0.01:0[b];[a][b]overlay,format=yuv420p,fps=30" -f v4l2 /dev/video2

wcbf's People

Contributors

xiaowenhu96 avatar

Watchers

James Cloos 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.