Help me debugs this script to create control ffmpeg from a bash script.
for f in $FILES
do
INPUT_MOVIE=`basename "${f%.*}.mkv"`
OUTPUT_MOVIE=${MOVIE:1}
OUTPUT_MOVIE=${OUTPUT_MOVIE:0:2}") processed "${OUTPUT_MOVIE:2}
/usr/bin/ffmpeg -i $INPUT_MOVIE -map 0:0 -vcodec copy -map 0:1 -acodec copy $OUTPUT_MOVIE
/usr/bin/sleep 3
done
I've tried attaching the sleep but the processes seems to start to pile up. Is there a way to do them sequentially so that one video is processed after the other?
ffmpeg
launches multiple instances of itself?$FILES
? (and don't just say "filenames", that's obvious. Show some examples, add them to your question). Spaces, newlines, globbing characters? Use an array. Also, always double-quote ALL your variables. And why the weird usage of bothbasename
AND${f%.*}
?$MOVIE
defined? do you meanINPUT_MOVIE
there? BTW, if you run something in the background and later want to wait until it's finished before doing something else, don't usesleep
. usewait
. that's what it's for. seehelp wait
in bash for details.