Page 1 of 1

Tip: Check if a video file is HEVC-encoded

PostPosted: 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

Re: Tip: Check if a video file is HEVC-encoded

PostPosted: Wed Feb 27, 2019 11:48 am
by Mr_Noodle
Thanks for the tip. I've moved the topic to the "Tips & Tricks" forum where it makes more sense.