static-captcha/run.sh

26 lines
581 B
Bash
Raw Normal View History

2025-01-02 20:23:30 +00:00
#!/bin/bash
2025-01-02 21:01:01 +00:00
X=200
Y=70
2025-01-02 20:23:30 +00:00
# Create the mask
convert \
-background none -fill black \
2025-01-02 21:01:01 +00:00
-pointsize 60 -size ${X}x${Y} -gravity center \
2025-01-02 20:23:30 +00:00
label:TEST1 mask.png
2025-01-02 21:01:01 +00:00
# Create large static image
convert -size 2000x${Y} canvas: +noise Random -monochrome -alpha off background.png
2025-01-02 20:23:30 +00:00
2025-01-02 21:01:01 +00:00
# Create video
ffmpeg -y -framerate 60 -loop true -t 10 -i background.png -i mask.png \
2025-01-02 20:23:30 +00:00
-filter_complex "
2025-01-02 21:01:01 +00:00
[0] crop=x=n:w=${X}:h=${Y} [bg];
[0] crop=x=out_w-n:w=${X}:h=${Y} [fg];
[1] alphaextract [mask];
[fg][mask] alphamerge [text];
[bg][text] overlay"\
-c:v libx264 -crf 10 -an out.mp4
# rm *.png