I have a problem with ffmpeg and spaces in folders/filenames. My code looks like this:
cd /volume1/PUBLIC/Musik/AutoConvert
find . -type d -exec mkdir -p -- /volume1/PUBLIC/Musik/Converted/{} \;
find -type f |sed 's|./||' |while read NEWNAME; do
ffmpeg -i ""/volume1/PUBLIC/Musik/AutoConvert/"$NEWNAME""" -codec:a libmp3lame -qscale:a 2 "/volume1/PUBLIC/Musik/Converted/"${NEWNAME%.[Ff][Ll][Aa][Cc]}".mp3"
echo done with file: "$NEWNAME"
done
But that fails with ffmpeg if there is a space anywhere. My Folder Structure looks like that:
user@NAS:/volume1/PUBLIC/Musik/AutoConvert$ find -type f |sed 's|./||'
A B/C.mp3
A B/C D.mp3
A/C D.mp3
A/C.mp3
The /Converted/A/C.mp3 does work, but thats the only one. All the others with Spaces in Folder oder Filename fail.
[NULL @ 0x20bb3e0] Unable to find a suitable output format for '/volume1/PUBLIC/Musik/Converted/A/C'
/volume1/PUBLIC/Musik/Converted/A/C: Invalid argument
done with file: A/C D.mp3
[NULL @ 0x11bf280] Unable to find a suitable output format for '/volume1/PUBLIC/Musik/Converted/A'
/volume1/PUBLIC/Musik/Converted/A: Invalid argument
done with file: A B/C D.mp3
[NULL @ 0x11f93e0] Unable to find a suitable output format for '/volume1/PUBLIC/Musik/Converted/A'
/volume1/PUBLIC/Musik/Converted/A: Invalid argument
done with file: A B/C.mp3
If i don't use the double " on ffmpeg -input i get the error:
/volume1/PUBLIC/Musik/AutoConvert/A: Is a directory
done with file: A B/C.mp3
/volume1/PUBLIC/Musik/AutoConvert/A: Is a directory
done with file: A B/C D.mp3
/volume1/PUBLIC/Musik/AutoConvert/A/C: No such file or directory
done with file: A/C D.mp3
It looks like i'm on the right track... just way too far from my goal.
Can anyone offer some help?