#!/bin/bash #SONG="01 You or Your Memory.mp3" #SONG="02 Up The Wolves.mp3" SONG=$1 IMAGES="~/Desktop/tmg/" OUTPUT=`echo "$SONG" | sed 's/\..*$/.mpg/'` # Get mp3 info SECONDS=`mp3info -p "%S\n" "$SONG"` # Get first image FIRST=`find tmg/ -type f -iname '*.jpg' | randomize | head -n 1` # Create font outline mp3info "$SONG" -p "Title: %t\nArtist: %a\nAlbum: %l" | convert "$FIRST" \ -font Times-Bold -pointsize 21 -fill black -stroke black -strokewidth 3 -annotate +50+270 @- \ .tmp.jpg # Fill font mp3info "$SONG" -p "Title: %t\nArtist: %a\nAlbum: %l" | mogrify \ -font Times-Bold -pointsize 21 -fill white -annotate +50+270 @- \ .tmp.jpg # Generate recipe file find tmg/ -type f -iname '*.jpg' | grep -v "$FIRST" | randomize | awk \ "BEGIN{\ s=$SECONDS + 1;\ c=0\ }\ {\ if(c == 0){\ print \".tmp.jpg:10\" print \"wipe:2\" c += 10;\ }else if(c < s){\ if(c + 20 > s)\ l = s - c;\ else\ l = 10;\ print \$0 \":\" l;\ c += l;\ if(c < s ){\ print \"wipe:2\";\ }else{\ print \"fadeout:2\";\ }\ }\ }" > .tmp.recipe # Render dvd slideshow #dvd-slideshow -a .tmp.mp3 -smp -L -s 640x360 -border 0 -w -r -n slideshow .tmp.recipe #dvd-slideshow -a .tmp.mp3 -smp -border 0 -w -s 528x360 -n slideshow .tmp.recipe dvd-slideshow -smp -border 0 -w -s 528x360 -n slideshow .tmp.recipe # Encode to mpg for youtube mencoder slideshow.vob \ -audiofile "$SONG" \ -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=1000:vhq:keyint=250:threads=2:vpass=1 \ -oac copy \ -ffourcc XVID \ -o "$OUTPUT" # Second encoding pass mencoder slideshow.vob \ -audiofile "$SONG" \ -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=1000:vhq:keyint=250:threads=2:vpass=2 \ -oac copy \ -ffourcc XVID \ -o "$OUTPUT" # Remove link rm -f .tmp.recipe .tmp.jpg rm -f slideshow.xml slideshow.log slideshow.vob rm -f divx2pass.log