Created
April 16, 2023 05:46
-
-
Save sathishrs/3962e7fc24a530378497e7e433fe00e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Input file | |
input_file="${1}" | |
# Run ffprobe to analyze the input file and capture the output | |
output=$(ffprobe -v quiet -show_streams -print_format json "$input_file") | |
# Check if the output contains video and/or audio streams | |
if [[ $output == *'"codec_type": "video"'* && $output == *'"codec_type": "audio"'* ]]; then | |
echo "Input file has both video and audio streams" | |
elif [[ $output == *'"codec_type": "video"'* ]]; then | |
echo "Input file has video stream" | |
elif [[ $output == *'"codec_type": "audio"'* ]]; then | |
echo "Input file has audio stream" | |
else | |
echo "Bad input" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +z check_audio_video_using_ffprobe.sh
./check_audio_video_using_ffprobe.sh FILENAME