Mtt
Mtt

Dear automation people, I need help. I want to monitor a folder (with sub folders) for any videos. For each video that isn’t already mpg/aac/HVEC, I’d like it converted to it. Lastly, I would like the old file deleted/replaced with the new file. (1/2)

|
Embed
Progress spinner
Mtt
Mtt

@Mtt I managed to get it working with FileFlows, but that app has been unreliable (freezes). I’m guessing it’s possible with Hazel + ffmpeg/Handbrake, but I haven’t been able to fully work it out. ChatGPT gets me close, but not all the way. (2/2)

|
Embed
Progress spinner
In reply to
yostos
yostos

@Mtt I haven't confirmed it through testing, but how about the following approach?

  • Since Hazel cannot determine the codec, use Kind = Movie & Extension != "mp4" as the condition.
  • In Hazel, select "Run shell script" as the action and specify the following script. However, note that the script assumes Fish shell is used, as this is based on my environment.

==> Script​ ​ In the script, FFmpeg is used for conversion, and if successful, the original file is deleted. If the conversion fails, the original file is moved to an error folder to avoid an infinite loop in Hazel.

Let me know if you need further adjustments!

|
Embed
Progress spinner
Mtt
Mtt

@yostos I am definitely saving this and will give it a shot. In the meantime, I managed to get FileFlows up and running. It was a port issue that I was having trouble diagnosing.

As a separate question, I'd love to see what you use Hazel for beyond this. My setup for it is pretty basic, but I know I'm leaving a lot on the table.​

|
Embed
Progress spinner
yostos
yostos

@Mtt I mostly use Hazel for simple tasks like deleting old files from my desktop and downloads folder, and organizing image files by date. I actually think this kind of straightforward usage is ideal for Hazel, as it keeps things clean and manageable without overcomplicating the setup. ​ The most complex rule I’ve created is for Micro.blog. When I add image files to a specific folder, Hazel triggers Optimage to optimize the images by resizing them so that the longest side is 1,800 pixels, which is ideal for Micro.blog. After resizing, Hazel moves the optimized files to another folder.

Just like in your case, I’m also using an embedded shell script in Hazel, where I call Optimage’s CLI in blocking mode from within the shell.​

|
Embed
Progress spinner
Mtt
Mtt

@yostos I like the image one. I’ve had a simple resize one for a while, but didn’t think to go as far as you did. Thanks!

|
Embed
Progress spinner