Automator ffmpeg script running twice

automator

I have an Automator app executing an FFMPEG shell script. For some reason the ffmpeg job run twice. Can someone please have a look?
Thanks
enter image description here

Best Answer

Get rid of those get/set variable actions, and it'll stop doing that. Keep in mind that if two actions appear "linked" in Automator, it means the output of one is being fed to the input of the other. You don't need variables in this case. Basically, the folder from "Ask for Finder Items" is being passed down the chain to your shell script, along the way setting it to a variable, and then getting the same folder, and adding it to the stream. This stream now contains two folders.

The purpose of the get/set variable actions are for when you have a situation where you want to use a piece of data with two actions which terminate the stream. You can't get the data once it's been consumed by said action, so you have to store it somewhere so that you can retrieve it again.