3 check_parsable_audio_ffprobe
() {
4 # Desc: Checks if ffprobe returns valid audio codec name for file
5 # Usage: check_parsable_audio_ffprobe [path FILE]
7 # Input: arg1: file path
8 # Output: exit code 0 if returns valid codec name; 1 otherwise
9 # Depends: ffprobe, die()
10 local file_in ffprobe_out
12 if [[ $# -ne 1 ]]; then die
"ERROR:Invalid number of args:$#"; fi;
16 # Check if ffprobe detects an audio stream
17 if ffprobe
-v error
-select_streams a
-show_entries stream
=codec_name
-of default
=nokey
=1:noprint_wrappers
=1 "$file_in" 1>/dev
/null
2>&1; then
23 # Fail if ffprobe returns no result
24 ffprobe_out
="$(ffprobe -v error -select_streams a -show_entries stream=codec_name -of default=nokey=1:noprint_wrappers=1 "$file_in")";
25 if [[ -z $ffprobe_out ]]; then
30 if [[ $return_state = "true" ]]; then
35 } # Checks if file has valid codec name using ffprobe
37 # Author: Steven Baltakatei Sandoval