Shell script problems.

Does anyone know what's going wrong here? I have a workflow that moves files to a NAS for my Kodi box. Unfortunately, the Kodi box (like many things) doesn't play h.265 well. And so I have a rule set up to separate out h.265 files out, and convert them automatically to h.264 using Handbrake CLI.
The rule is as follows:
Comment - does not contain - handbraked (just using this to mark files as converted)
Passes Shell Script - [below]
Unless I've written this wrong, grep is supposed to search the output of ffprobe for "Video: hevc" and pass the script if it finds it. But it's not finding it. Any and all files fail to pass and just move on to the next rules.
The rule is as follows:
Comment - does not contain - handbraked (just using this to mark files as converted)
Passes Shell Script - [below]
- Code: Select all
if ffprobe `$1` 2> | grep 'Video: hevc'; then
exit 0
else
exit 1
fi
Unless I've written this wrong, grep is supposed to search the output of ffprobe for "Video: hevc" and pass the script if it finds it. But it's not finding it. Any and all files fail to pass and just move on to the next rules.