You have a bunch of jpg's and want to create slideshow with some music in background, i.e., mpeg.
jpgind --mpeg -S 320 /path/to/jpeg/files/*.jpg
if ( [ "$1" != "" ] && [ -f "$1" ] ) ; then ^^^^
./mkpeg.sh /path/to/file.mp3
and you get index.mpeg which could be played using mplayer