I have a quick shell script that is taking a list of input and output names line by line and providing them to ffmpeg for conversion. Some of the output paths have spaces in them, and I receive one of two errors, no matter how I escape or double quote the path with spaces.
Input File
file1.avi "output path"/file1.mp4
file1.avi "output\ path"/file1.mp4
file1.avi "output path/file1.mp4"
file1.avi output\ path/file1.mp4
convert.sh
while read -r file1 file2; do ffmpeg -i "$file1" -c copy -bsf:a aac_adtstoasc $file2; done <list
One error that I receive is:
"output path"/file1.mp4: No such file or directory
The other error that I receive is:
Unable to find a suitable output format for '"output'
The variations in the input file lines are there to show the things that I have tried in order to escape the space. I have also tried the same with adding double quotes around file2 in the shell script.