How to identify HDR video?
Assuming your file is ${F}, the below is an efficient means I have been able to create:

COLORS=$(ffprobe -show_streams -v error "${F}" |egrep "^color_transfer|^color_space=|^color_primaries=" |head -3)
for C in $COLORS; do
        if [[ "$C" = "color_space="* ]]; then
                COLORSPACE=${C##*=}
        elif [[ "$C" = "color_transfer="* ]]; then
                COLORTRANSFER=${C##*=}
        elif [[ "$C" = "color_primaries="* ]]; then
                COLORPRIMARIES=${C##*=}
        fi      
done    
if [ "${COLORSPACE}" = "bt2020nc" ] &amp;&amp; [ "${COLORTRANSFER}" = "smpte2084" ] &amp;&amp; [ "${COLORPRIMARIES}" = "bt2020" ]; then 
        echo ${F}
fi


I use this inside a looping function to know when to use https://github.com/Fmstrat/ffmkv to create an SDR version of a video on one of the presets.