JA_UK Posted February 26 Share Posted February 26 Hi, I have made myself a workflow which takes file input via a universal action. The purpose of the workflow is to assist me to quickly and easily have ffmpeg duplicate and convert non-mp4 video files to mp4 versions. I have it set to do the following: 1 - Get the file extension of the file, 2 - If the file extension is already .mp4, flash up text saying 'already an mp4 file', then end the workflow, 3 - If not, pass details of the file to ffmpeg and get it to produce an mp4 version of the same file, with the new file having the same filename (other than it will now end in .mp4), in the same directory as the original. I have steps 1 and 2 working fine, and step 3 works fine in all cases when I use the Terminal Command option as follows: ffmpeg -i {var:original-filepath-and-filename} {var:original-filepath-and-new-filename} The variables are 'escaped' during the workflow, using the Replace action to replace all spaces with '\ '. I would like to use the Run Script option instead, so it all works in the background without opening a Terminal window. The following is the code in the Run Script action: PATH="/usr/local/bin:$PATH" ffmpeg -i ${original-filepath-and-filename} ${original-filepath-and-new-filename} This works fine, but only when the file to be converted is located in a place where there are no spaces in the names of any of the folders in the filepath. Example: If the file to be converted is located at /Users/me/Desktop/video.mkv both the Terminal Command option and the Run Script option work fine. If the file to be converted is located at /Users/me/Desktop/Video Projects/video.mkv only the Terminal Command option works, and the Run Script option does not. The debugger shows the following when the Run Script option does not work: "/Users/me/Desktop/Video\: No such file or directory". Any help greatly appreciated. Thanks. Link to comment
vitor Posted February 26 Share Posted February 26 40 minutes ago, JA_UK said: This works fine, but only when the file to be converted is located in a place where there are no spaces in the names of any of the folders in the filepath. You have to enclose your variables in double quotes, same as you would need to if you were in a Terminal. That’s the behaviour of the shell. Link to comment
JA_UK Posted February 27 Author Share Posted February 27 That's great. Also figured out I don't need to go through the steps of escaping the filepath / filename when using double quotes also. Thank you. Link to comment
vitor Posted February 27 Share Posted February 27 And you also don’t need to set that PATH. Link to comment
JA_UK Posted February 29 Author Share Posted February 29 I'm not sure I understand the whole PATH thing yet, to be honest. But I've removed the PATH bit of the command and everything seems to be working fine - thank you. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now