I am trying to write a simple script to recode all the .mp3 files in a folder to 160k using ffmpeg. I have one little problem, I would like the output file to be the same as the input file (rewrite) so ffmpeg warns you about this and asks you for confirmation (y/N). Is there a way to automatically "echo a y and an enter" (sorry for the poor explanation) for every question it asks? I have tryied the yes command but it infinitely prints y and the loop won't finish. This is the code I have written so far.
for f in *.mp3; do
ffmpeg -i $f -ab 160k $f
Is it possible to do something like this:
ffmpeg -i $f -ab 160k $f & echo -e "y \r"
I guess the trick is in the piping/redirection... is the & correct? I know I can avoid this problem simpli not rewriting the original file, but I am curious and would like to enlighten my mind a bit. Thanks.