Skip to content

Commit

Permalink
Allow for fade to/from black, and text overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Apr 28, 2016
1 parent 4be7d6a commit ab282fd
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 12 deletions.
6 changes: 6 additions & 0 deletions config.txt.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ ZOOM=1
POINTS=1
GPX=0
MINUTELY=1
# Setting this to "1" means that we don't use a title for fading, but just
# from/to black.
BLACK=0
# If title overlay is set, we overlay in the right hand bottom corner the
# title. This is generated from NAME through create-artwork.sh
TITLE_OVERLAY=0
10 changes: 10 additions & 0 deletions create-artwork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
mkdir -p artwork

NAME=`cat config.txt | grep "name=" | sed 's/name=//'`
TITLE_OVERLAY=`cat config.txt | grep "TITLE_OVERLAY=" | sed 's/TITLE_OVERLAY=//'`

# OVERLAY
if test "x${TITLE_OVERLAY}" = "x1";
then
convert -size 1280x720 xc:transparent \
-gravity SouthEast -stroke black -fill white -font "FreeSans-Medium" -pointsize 32 \
-annotate +10+10 "$NAME" \
artwork/overlay.png
fi

# TITLE
convert -size 1280x720 xc:black \
Expand Down
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export EXTRA_PATH=/home/derick/dev/osmosis-latest/bin
export EXTRA_PATH=/storage1/osm/videos/osmosis-latest/bin

# NEVER rm -rf changes/*osc
#rm -rf changes/*json changes/cache* changes/*env changes/*png images/*
Expand Down
49 changes: 38 additions & 11 deletions mkfilm.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,60 @@
#!/bin/sh

FIRST_TEN=`(for i in images/aparty-201*.png; do echo $i; done) | head -11`
LAST_TWENTY=`(for i in images/aparty-201*.png; do echo $i; done) | tail -20`
INTRO=`(for i in images/aparty-201*.png; do echo $i; done) | head -11`
OUTTRO=`(for i in images/aparty-201*.png; do echo $i; done) | tail -10`
BLACK=`cat config.txt | grep "BLACK" | cut -d "=" -f 2-`
if test "x${BLACK}" = "x1"; then
BLACK=1
else
BLACK=0
fi

OPACITY=-9

#remove the last 11 images, as they need to be redone due to fading
TO_REMOVE=`(for i in images/x-*jpg; do echo $i; done) | tail -21`
TO_REMOVE=`(for i in images/x-*jpg; do echo $i; done) | tail -11`
rm $TO_REMOVE

for i in images/aparty*.png; do
IN_FIRST=`echo ${FIRST_TEN} | sed "s@.*\(${i}\).*@\1@"`
IN_FIRST=`echo ${INTRO} | sed "s@.*\(${i}\).*@\1@"`
if test "x${IN_FIRST}" = "x$i"; then
OPACITY=`expr $OPACITY + 10`
echo $OPACITY
fi

IN_LAST=`echo ${LAST_TWENTY} | sed "s@.*\(${i}\).*@\1@"`
IN_LAST=`echo ${OUTTRO} | sed "s@.*\(${i}\).*@\1@"`
if test "x${IN_LAST}" = "x$i"; then
OPACITY=`expr $OPACITY - 5`
OPACITY=`expr $OPACITY - 10`
echo $OPACITY
fi

b=`echo $i | sed 's/aparty//' | sed 's/images\///' | sed 's/.osm.png//'`
if [ ! -f images/x$b.jpg ]; then
# If we have an extra overlay (3D building outlines, lay it over the
# top
if [ -f images/bparty$b.osm.png ]; then
composite images/bparty$b.osm.png $i /tmp/x.png
else
cp $i /tmp/x.png
if [ -f artwork/overlay.png ]; then
composite artwork/overlay.png $i /tmp/x.png
else
cp $i /tmp/x.png
fi
fi

# First batch of images
if test "x${IN_FIRST}" = "x$i"; then
composite -blend ${OPACITY} /tmp/x.png artwork/title.jpg /tmp/y.png
# If we're just doing fading from/to black
if test "x${BLACK}" = "x1"; then
composite -blend ${OPACITY} /tmp/x.png -size 1280x720 xc:black -alpha Set /tmp/y.png
# Otherwise we fade in from the artwork
else
composite -blend ${OPACITY} /tmp/x.png artwork/title.jpg /tmp/y.png
fi
else
cp /tmp/x.png /tmp/y.png
fi

if test "x${IN_LAST}" = "x$i"; then
composite -compose Multiply changes/diff$b.png /tmp/y.png /tmp/z.png
composite -blend ${OPACITY} /tmp/z.png -size 1280x720 xc:black -alpha Set images/x$b.jpg
Expand All @@ -44,9 +65,15 @@ for i in images/aparty*.png; do
fi
done

mencoder "mf://artwork/title*.jpg" -mf fps=25 -o title.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=16000
mencoder "mf://images/x*.jpg" -mf fps=25 -o middle.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=16000
mencoder "mf://artwork/end*.jpg" -mf fps=25 -o end.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=16000

mencoder -oac copy -oac copy -ovc copy -o test.avi title.avi middle.avi end.avi
if test "x${BLACK}" = "x1";
then
mv middle.avi test.avi
else
mencoder "mf://artwork/title*.jpg" -mf fps=25 -o title.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=16000
mencoder "mf://artwork/end*.jpg" -mf fps=25 -o end.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=16000
mencoder -oac copy -oac copy -ovc copy -o test.avi title.avi middle.avi end.avi
rm title.avi middle.avi end.avi
fi
mencoder -ovc copy -audiofile /home/derick/Artifact.mp3 -oac copy test.avi -o progress.avi

0 comments on commit ab282fd

Please sign in to comment.