I have a bunch of .mp3 files that I would like to modify so that they start with a voice saying the file name. The easiest way to do this (or so I thought), would be something like the following:
for file in ./*.mp3; do BASE="$(basename "$file" .mp3)" mv $file $BASE-bak.mp3 say "[[volm 0.4]] $BASE" -o $BASE-pre.aiff ffmpeg -i $BASE-pre.aiff -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 $BASE-pre.mp3 rm $BASE-pre.aiff mp3cat -o $file $BASE-pre.mp3 $BASE-bak.mp3 done
This almost works, but the resulting mp3 file is broken (it is the right length, but silent, and always stops playing after the length of time taken (I assume) to say the file name (roughly 2 seconds). Everything seems to break at the
mp3cat step. However, using
mp3wrap or other things don't seem to work either, and my guess is that it's something to do with the file produced by
say not having the right amount of streams (whatever that might mean).
Suggestions on how to fix this, or how to do this an entirely different way?