I updated it a little bit, but I'm still not getting the results I should be getting:
#!/bin/bash
find "$1" -type f | while read filename
do
videoCodec=$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$filename")
audioCodec=$(ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$filename")
audioChannels=$(ffprobe -v error -select_streams a:0 -show_entries stream=channels -of default=noprint_wrappers=1:nokey=1 "$filename")
echo $videoCodec $audioCodec $audioChannels $filename
if [ $videoCodec = "h264" ] && [ $audioCodec = "aac" ] && [ audioChannels = "2" ] ; then
echo "Direct play capable"
fi
done
I run this on a folder containing a file that meets all the if conditions ("h264 aac 2 ./Black.Mass.(2015)/Black.Mass.(2015).mp4") but do not get the "Direct play capable" echo.
$
out of audioChannels in theif
statement.