Reputation: 57946
I was kindly helped a few minutes ago by a user named Juliano and the script works fine but it just baffles me why it continues to work when I press enter, if I don't it just sits there untill I have to keep pressing enter. I thought that was the job of the for loop?
#!/bin/bash
TIMEFORMAT=%6R
for file in /home/test/videos/* ; do
#for loop 2
for (( i = 0; i < 10; i++ )); do
#for loop 3
for ext in avi mpg wmv mov; do
base="${file##*/}"
elapsed=$({ time ffmpeg -i "$file" -ar 44100 "${file%/*}/done/${base%.*}.$ext" &>/dev/null; } 2>&1)
echo "$file $i $ext took $elapsed seconds"
done
done
done
Also can I swap for loops 2 and 3?
Thanks all
How can I also make use of the variable "i" in the for loop so that it concatinates at the end of the file. Is this correct:
${file%/}/done/${base%.}$i.$ext
Thank you for anymore help.
Upvotes: 0
Views: 2761
Reputation: 21459
I suspect that the ffmpeg
program is what's waiting for the keypress at the end of the process. You might be able to send it a keypress, like:
echo -e \\n | time ffmpeg ...
which might echo a new line "into" the standard input of the ffmpeg program.
And yes, you can swap loop #2 and #3.
Upvotes: 3
Reputation: 41407
I already answered in the other question. It was ffmpeg asking you to overwrite the output file. Giving unique names (with $i in the filename) and passing -y to ffmpeg solves the problem.
Upvotes: 3