How can I make the script output the encoded file in a user defined directory?
I'm trying to build an in-house media file encoder based on Automator and ffmpeg
.
I want the source file(s) to be dropped on the app's icon and then ask the user where to output the encoded files.
So far I have an Automator app where I drop files onto it and it runs this AppleScript:
on run {input, parameters}
tell application "Terminal"
activate
set filesString to ""
repeat with file_ in input
set filesString to filesString & " " & quoted form of (POSIX path of file_)
end repeat
do script "for f in" & filesString & "; do
ffmpeg -i \"$f\" -c:v copy -an ${f%.*}_264.mp4
done"
end tell
return input
end run
Currently the app outputs the encoded file at the same directory as the input file.
How can I make Automator ask the user for and use a destination directory?
Best Answer
Automator - 'Ask for Finder Items'
You should probably want to clean up your code. Now you are using and AppleScript and Automator and BASH.
Anyway, in Automator you can ask for a location, store that variable and use it later in your Shell script. You can 'stack' variables in an array by concatenating 'Get Value of Variable'.
Example code and screenshot: