Hi,
I'm trying to build a watch folder for FFMPEG that compress files and move them to a specific destination folder. Using this command line:
ffmpeg -y -i $1 -vcodec libx264 -b:v 2M -s 1280x720 -pix_fmt yuv420p -b:a 192k /Volumes/EncodingServer/Output/_MP4/$1.mp4
Which results in this command
ffmpeg -y -i /Volumes/EncodingServer/Input/_MP4/Test.mov -vcodec libx264 -b:v 2M -s 1280x720 -pix_fmt yuv420p -b:a 192k /Volumes/EncodingServer/Output/_MP4//Volumes/EncodingServer/Input/_MP4/Test.mov.mp4
Naturally this errors out.
The problems are:
1. $1 is used as a variable for the matched file(s) but include their paths (eg. /Volumes/Disk/Test.mov instead of Test.mov). Is it possible to only pass the file name so that this can be used to specify the output file name for ffmpeg?
2. Also how can I pass the matched file without the file extension (to get Test.mp4 instead of Test.mov.mp4
3. Also I noticed that when one has spaces in the matched files names, Hazel doesn’t seem to escape the file name (eg. turn "Test 1" into "Test\ 1"). Because of this ffmpeg errors out.
4. Finally I can't change the out file location dynamically using Hazel, but have to hardcode the path into the bash script. I assume this is not solvable?