See how it's done in `lib/private/preview/movies.php`, it also excludes Windows...
It's still using `which` but there is another PR that wants to change it to `command -v`.