#!/bin/bash
rm -f tfifo
rm -f overlay.rgba
mkfifo tfifo
convert overlay.png overlay.rgba
(
alpha=-255
fade=20
while [[ $alpha -le 0 ]]
do
(echo "RGBA32 200 200 0 0 $alpha 1"; cat overlay.rgba) >tfifo
sleep 0.1
let t=alpha+fade
if [[ $alpha -ne 0 && $t -gt 0 ]]; then t=0; fi
alpha=$t
done
sleep 0.5
while [[ $alpha -ge -255 ]]
do
(echo "RGBA32 200 200 0 0 $alpha 1"; cat overlay.rgba) >tfifo
sleep 0.1
let t=alpha-fade
if [[ $alpha -ne 0 && $t -le -255 ]]; then t=-255; fi
alpha=$t
done
) &
pid=$!
mplayer -vf bmovl=0:0:tfifo video.ogv
rm -f tfifo
rm -f overlay.rgba
if kill -0 $pid; then kill -9 $pid; fi
# Released under GNU General Public License 3 by celeste:crystalfaery 2011-02-07 00:33:18+00:00
# http://www.crystalfaeries.net/linux/bin/fade
syntax highlighted by Code2HTML, v. 0.9.1