working, but stops part way thru

This commit is contained in:
Oliver Atkinson 2025-01-02 14:01:01 -07:00
parent e2cf21bdfa
commit 13032ccb09

47
run.sh
View File

@ -1,44 +1,25 @@
#!/bin/bash
# Tehcnically, this works. However, the static needs to scan from one side to the
# other so you can see the difference in the two
X=100
Y=50
FRAMES=10
X=200
Y=70
# Create the mask
convert \
-background none -fill black \
-pointsize 24 -size ${X}x${Y} -gravity center \
-pointsize 60 -size ${X}x${Y} -gravity center \
label:TEST1 mask.png
# create pictures of static
mkdir -p back fore out
for i in $(seq 1 $FRAMES); do
convert -size ${X}x${Y} canvas: +noise Random -monochrome back/${i}.png
# Generate image of static, then mask it out using the mask.png
convert -size ${X}x${Y} canvas: +noise Random -monochrome mask.png -compose CopyOpacity -composite fore/${i}.png
done
# Create large static image
convert -size 2000x${Y} canvas: +noise Random -monochrome -alpha off background.png
for i in $(seq 1 $FRAMES); do
# Layer the two images
convert back/$i.png fore/1.png -gravity center -background None -layers Flatten out/$i.png
done
# create gif
# convert -delay 1 -loop 0 out/* out.gif
# try video
convert -size 1920x50 canvas: +noise Random -monochrome -alpha off background.png
ffmpeg -y -framerate 30 -loop true -t 10 -i background.png -i mask.png -i background.png \
# Create video
ffmpeg -y -framerate 60 -loop true -t 10 -i background.png -i mask.png \
-filter_complex "
[0]crop=x=n:w=${X}:h=${Y}[bg];
[2]crop=x=iw-n:w=${X}:h=${Y}[fg];
[1]alphaextract[mask];
[fg][mask]alphamerge[top];
[bg][top]overlay=x=0:y=0"\
-c:v libx264 out.mp4
[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