I'm trying to batch encode 45 video files, and copy the encoded files into an existing subfolder called "encode"
I've used the suggested code from this question (https://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-directory-with-ffmpeg) But, I don't know how to capture the original file names (with spaces and punctuation) and use that as the new file name in the new directory.
Here's the code I'm using so far:
for i in *.mp4;
do name=`echo "${i%.*}"`;
echo $name;
ffmpeg -i “$i” -vf "scale='if(gt(a*sar,16/9),640,-1)':'if(gt(a*sar,16/9),-1,360)',pad=640:360:(ow-iw)/2:(oh-ih)/2,setsar=1" -vcodec libx264 -b:v 1600k -bufsize:v 1600k -r 30000/1001 “encoded/$name.mp4”
done
It's giving me an "invalid argument" error message when I run it - probably because I haven't specified the names correctly(?)
The ffmpeg code that I'm using does work (I can encode individual file) but I haven't figured out how to batch encode the entire directory.
If anyone can let me know what I'm doing wrong, I would love to know!
Thank you!