Last active
October 20, 2022 07:48
-
-
Save krpors/3bd71b06ae8131ff6d8b809e2e63ff3a to your computer and use it in GitHub Desktop.
Overlay image with webcam using v4l2loopback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#sudo rmmod v4l2loopback | |
#sudo modprobe v4l2loopback devices=1 card_label="KEV CAM" | |
# -vf "drawtext=fontfile=/home/krpors/Development/qualogy/qualogy-revealjs/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.ttf:text='Tijn sux':fontcolor=white:fontsize=48:box=1:[email protected]:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" \ | |
# pix_fmt yuv420p is required for firefox etc! | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
exit 0 | |
# edge detect | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25, edgedetect=low=0.1:high=0.2" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# chromatic aberration | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25, rgbashift=rh=-10:bh=-10:edge=smear" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# rotate meuk: | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25, rotate=0.5*sin(0.1*PI*t)" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# Nog beter: | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=sin(2*PI*t)*25:cos(2*PI*t)*25" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# sobel crap | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25, sobel=planes=0x1:scale=2" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# border: | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25, fillborders=top=50:left=50:right=50:bottom=50:mode=fixed:color=00aa00" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# gay filter | |
ffmpeg \ | |
-i /dev/video0 \ | |
-i napoli.png \ | |
-filter_complex "[0:v][1:v] overlay=25:25, geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'" \ | |
-pix_fmt yuv420p \ | |
-f v4l2 /dev/video2 | |
# Stream image to video | |
ffmpeg -loop 1 -framerate 1 -i windows\ update.png -r 30 -pix_fmt yuv420p -f v4l2 /dev/video2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment