I'm trying to covert all m4a to mp3 my code look like this:
find . -name '*.m4a' -print0 | while read -d '' -r file; do
ffmpeg -i "$file" -n -acodec libmp3lame -ab 128k "${file%.m4a}.mp3";
done
but it only work for first mp3 file for next it show error:
Parse error, at least 3 arguments were expected, only 1 given in string '<All files in one line>'
Enter command: <target>|all <time>|-1 <command>[ <argument>]
The files contain spaces ampersands and parenthesis.
ffmpeg
withecho --
and inspect the output to ensure all is right.IFS
to the null string as well... |while IFS= read -d '' -r file; ...
. You could use all withfind
instead of using a shell while-loop