This commit is contained in:
Talebian 2020-04-15 10:18:39 +02:00
parent 825a932613
commit 15c5a94ab4

68
spoofcam.sh Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
#
# Non ho responsabilità sulla qualità del codice
# lo script non è mio, mi sono limitato a renderlo
# funzionante
#
# Talebian
#
recover(){
rm /dev/video0
mv /dev/video69 /dev/video0
exit
}
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
modprobe v4l2loopback exclusive_caps=1
trap recover SIGINT
TMPHOME=$(pwd)
mv /dev/video0 /dev/video69 #nice
fakecam=$( v4l2-ctl --list-devices | grep Dummy -A 1 | grep /dev/video | sed 's/\t//g' | sed 's/[/]dev[/]//' )
cd /dev
ln -s $fakecam video0
cd $TMPHOME
case $1 in
"pic")
if [ -f $2 ]
then
ffmpeg -loop 1 -re -i $2 -f v4l2 -vcodec rawvideo -pix_fmt yuv420p /dev/video0
else
echo "File does not exists"
fi;;
"vid")
if [ -d $2 ]
then
cd $2
while [ 1 ]
do
for file in *.mp4; do ffmpeg -re -i "$file" -map 0:v -f v4l2 /dev/video0; done
for file in *.mkv; do ffmpeg -re -i "$file" -map 0:v -f v4l2 /dev/video0; done
for file in *.webm; do ffmpeg -re -i "$file" -map 0:v -f v4l2 /dev/video0; done
done
else
echo "Directory does not exists"
fi;;
*)
echo """Usage:
pic <picture_file>
or
vid <videos_directory>""";;
esac
recover