#!/usr/bin/env zsh
# get_codec uses `mediainfo` to print the codec of a video file.

set -o errexit
set -o nounset

if (( $# == 0 ))
then
  echo "Usage: $0 VIDEO_FILE" >&2
  exit 1
fi

ffprobe -v error -select_streams v:0 \
  -show_entries stream=codec_name \
  -of csv=print_section=0 "$1"
