unix4artists/ffmpeg/basic/info.sh

23 lines
598 B
Bash

#!/bin/bash -e
#####################################################
#
# "ffprobe" is an application that comes bundled with
# the ffmpeg installation. It will print file
# information about the streams within video and audio
# files.
#
# Usage: bash ffmpeg/basic/info.sh <file>
#
#####################################################
if [ "${1}" == "" ]; then
echo "Please include a path to a file as the first argument"
exit 1
fi
if [ "${2}" != "json" ]; then
ffprobe -v quiet -show_format -show_streams "${1}"
else
ffprobe -v quiet -print_format json -show_format -show_streams "${1}"
fi