Tip: Check if a video file is HEVC-encoded

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Tip: Check if a video file is HEVC-encoded Wed Feb 27, 2019 10:58 am • by snorbaard
Hi All,
Thought I'd share a rule I created for a niche requirement I had:

Check each time a new video file is added to the Downloads folder and see whether it's HEVC (x.265) encoded.
Requirements:
- Have Mediainfo installed. In my case it's installed in /usr/local/bin/mediainfo by installing it via Homebrew's brew command* :
Code: Select all
brew install mediainfo

Setup:
Here is my ruleset:
Image

Here is my Shell Script (remember to set it to run in shell /bin/bash
Code: Select all
CODEC=$(/usr/local/bin/mediainfo --Inform="Video;%Format%" "$1")

if [ $CODEC == 'HEVC' ]
then
   echo "Output 0. HEVC"
   exit 0
else
   echo "Output 1. Not HEVC"
   exit -1
fi

The echo commands are optional and won't do anything. I used them during debugging.
*You can install Homebrew from here: https://brew.sh
snorbaard
 
Posts: 10
Joined: Fri Jan 06, 2017 5:18 am

Thanks for the tip. I've moved the topic to the "Tips & Tricks" forum where it makes more sense.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Tips & Tricks - DO NOT POST QUESTIONS