#!/usr/bin/env bash

# shellcheck disable=SC2312
for file in "$@"; do
  (
    printf '%s' $(
      ffprobe -v error -select_streams v:0 -show_entries stream=width,height \
        -of default=noprint_wrappers=1:nokey=1 "${file}" \
        | awk -v d=" x " '{ s=(NR==1?s:s d)$0 } END { print s }'
    ) \
      && (
        if [ "$#" -ne 1 ]; then
          printf '%s' : "${file}"
        fi
      ) \
      && echo
  ) || echo 0
done
