Jump to content

Convert Video to MP4 - FFMPEG

Recommended Posts



Alfred Workflow to Convert a video to MP4 with hinted streaming for web.  Reduces file size significantly without much video reduction.





Alfred - 3.6.1+

ffmpeg (recomend installing with Homebrew: https://brew.sh/)



These are the flags I started out with. I don't know if I will rember to update the readme if I change them: -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 256k -r:a 48000 -movflags faststart

If you want to change them, you will need to do so in the bash script.



Open Alfred and type "encode", space, then the name of the file to convert. I will put the updated version in the same place, but will add -encoded.mp4 to the name.

Example: encode example.mov

Will Become: example-encoded.mp4


Big movies will take a while to encode so it will let you know when it starts and when it finishes with big type on the screen and a sound.



Link to comment

Hi, @slackticus, welcome to the forum.


I'm afraid that, as best I can tell, the workflow simply doesn't work as it is. The encode File Filter has no scope, so can't possibly find any files. The File Action isn't connected to anything, so does nothing.


They should be very easy to fix, though.


A couple of additional tips:


You should consider adding +public.movie to the File Types of your File Filter and File Action. That way, they'll accept any video file, not just .mp4 and .mov files.


You should also consider adding the source code of your workflow to the GitHub repo, not just the exported workflow. GitHub is intended for source code, not finished programs, and having the source there will make it much easier for people to submit pull requests.


I would have submitted a PR to fix the above issues, but you would have no easy way to see what I'd changed because there'd just be an opaque zip file, not the lines of code that I'd changed.

Edited by deanishe
Link to comment
  • 3 years later...

For everyone who reads this now...


I had to adjust the Run Script like this:

# the folder
DNAME=$(dirname "$query")
# the filename
FNAME=$(basename "$query")
# output the directory name, and folder name
#echo "Folder: '$DNAME', File: '$FNAME', Name: '$SNAME'"
# This worked but the file name came out "shipping-address.mp4-encoded.mp4"
/opt/homebrew/Cellar/ffmpeg/4.4.1_3/bin/ffmpeg -i "$DNAME/$FNAME" -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 256k -r:a 48000 -movflags faststart "$DNAME/$SNAME.mp4"
rm "$query"


It is also important that you select the right file of your ffmpeg. To see where it is execute the following in your terminal: 

brew --prefix ffmpeg  




Edited by Plutoris
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...