updates from the article
This commit is contained in:
parent
11cdf2fdc2
commit
9c9ac98135
17
merge.sh
Executable file
17
merge.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Split the frames out
|
||||||
|
mkdir frames
|
||||||
|
ffmpeg -i $1 frames/frame%04d.png
|
||||||
|
|
||||||
|
# Change the white -> transparent
|
||||||
|
mkdir chromakeyed
|
||||||
|
for f in frames/*
|
||||||
|
do
|
||||||
|
convert $f -fuzz 50% -transparent white chromakeyed/$(basename $f)
|
||||||
|
done
|
||||||
|
|
||||||
|
# Merge all the frames into one image
|
||||||
|
convert chromakeyed/* -background red -flatten flat.png
|
||||||
|
|
||||||
|
rm -r frames chromakeyed
|
12
run.sh
12
run.sh
@ -1,7 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
FPS=30
|
||||||
|
DURATION=5
|
||||||
|
COMPRESSION=40
|
||||||
|
|
||||||
X=400
|
X=400
|
||||||
Y=100
|
Y=150
|
||||||
|
|
||||||
# Create the mask
|
# Create the mask
|
||||||
convert \
|
convert \
|
||||||
@ -13,13 +17,13 @@ convert \
|
|||||||
convert -size 2000x${Y} canvas: +noise Random -monochrome -alpha off background.png
|
convert -size 2000x${Y} canvas: +noise Random -monochrome -alpha off background.png
|
||||||
|
|
||||||
# Create video
|
# Create video
|
||||||
ffmpeg -loglevel error -hide_banner -y -framerate 60 -loop true -t 10 -i background.png -i mask.png \
|
ffmpeg -loglevel error -hide_banner -y -framerate $FPS -loop true -t $DURATION -i background.png -i mask.png \
|
||||||
-filter_complex "
|
-filter_complex "
|
||||||
[0] crop=x=n:w=${X}:h=${Y},split[bg][a];
|
[0] crop=x=n:w=${X}:h=${Y},split[bg][a];
|
||||||
[a] hflip,vflip [flip];
|
[a] hflip,vflip [flip];
|
||||||
[1] alphaextract [mask];
|
[1] alphaextract [mask];
|
||||||
[flip][mask] alphamerge [text];
|
[flip][mask] alphamerge [text];
|
||||||
[bg][text] overlay"\
|
[bg][text] overlay"\
|
||||||
-c:v libx264 -crf 10 -an out.mp4
|
-c:v libx264 -crf $COMPRESSION -an out.mp4
|
||||||
|
|
||||||
# rm mask.png
|
rm mask.png background.png
|
||||||
|
Loading…
Reference in New Issue
Block a user