eu mesmo encontrei a resposta.
#!/bin/bash
THEDATE=$(date --date="yesterday" +%d.%m.%y)
MUSIC=$(shuf -n1 -e /mnt/pi/youtube-music/*)
cd /mnt/pi/timelapse
ffmpeg -thread_queue_size 512 -r 30 -pattern_type glob -i '*.jpg' -i $MUSIC -c copy -preset slow -pix_fmt yuv420p -shortest /mnt/pi/timelapse-$THEDATE.mp4