diff --git a/merge.sh b/merge.sh new file mode 100755 index 0000000..4c98727 --- /dev/null +++ b/merge.sh @@ -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 \ No newline at end of file diff --git a/run.sh b/run.sh index ea56c00..353d650 100755 --- a/run.sh +++ b/run.sh @@ -1,7 +1,11 @@ #!/bin/bash +FPS=30 +DURATION=5 +COMPRESSION=40 + X=400 -Y=100 +Y=150 # Create the mask convert \ @@ -13,13 +17,13 @@ convert \ convert -size 2000x${Y} canvas: +noise Random -monochrome -alpha off background.png # 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 " [0] crop=x=n:w=${X}:h=${Y},split[bg][a]; [a] hflip,vflip [flip]; [1] alphaextract [mask]; [flip][mask] alphamerge [text]; [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