I have the following bash script that I use for converting files to h.264 encoding, which falls apart whenever I pass a file with spaces in the name:
`
for File in "$@"
do
Name=$(echo "$File" | cut -f 1 -d '.')
ffmpeg -i $File -vcodec libx264 -acodec aac -pix_fmt yuv420p "h264_$Name.mp4"
done
`
Not a problem for any files I've written, but when I'm converting a lot of files from other sources that have included whitespace in the filenames, it could potentially become a real pain.
Is there a way I can modify this script to properly handle this condition? Or is there a way I can pass the parameters to the script?
Thanks!!! Kirk
I'm calling my script with commands line like:
- ToH264MP4 "My Video Name With Spaces.mov"
- ToH264MP4 *
It's failing because it's treating each filename portion separated by spaces as a unique input parameter, rather than passing the full filename.