summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalvideowebencode27
1 files changed, 23 insertions, 4 deletions
diff --git a/localvideowebencode b/localvideowebencode
index 4f43a99..70a5829 100755
--- a/localvideowebencode
+++ b/localvideowebencode
@@ -310,11 +310,30 @@ case "$quality" in
esac
gpudevice=${gpudevice:-/dev/dri/renderD128}
if [ auto = "$gpu" ]; then
- vainfo=$(vainfo --display drm --device "$gpudevice" 2>/dev/null | perl -nE '/Driver version:\s*\K.*/ and say $&; /VAProfile\S+\s*:\s*VAEntrypointEncSliceLP/ and say $&')
+ vainfo=$(vainfo --display drm --device "$gpudevice" 2>/dev/null | grep -Po 'Driver version:\s*\K.*')
case "$vainfo" in
'') gpu=;;
-# TODO *"Intel iHD driver"*) gpu=qsv;;
- *) gpu=vaapi;;
+ *)
+ for vformat in vp8 vp9 h264; do
+ eval "no_gpu_decoder_$vformat=yes"
+ eval "no_gpu_encoder_$vformat=yes"
+ done
+ case $(vainfo --display drm --device "$gpudevice" 2>/dev/null | grep -Po 'VAProfile\S+\s*:\s*VAEntrypointVLD') in
+ *VAProfileVP8Version0_3*) no_gpu_decoder_vp8=;;
+ *VAProfileVP9Profile0*) no_gpu_decoder_vp9=;;
+ *VAProfileH264ConstrainedBaseline*) no_gpu_decoder_h264=;;
+ esac
+ case $(vainfo --display drm --device "$gpudevice" 2>/dev/null | grep -Po 'VAProfile\S+\s*:\s*VAEntrypointEncSlice') in
+ *VAProfileVP8Version0_3*) no_gpu_encoder_vp8=;;
+ *VAProfileVP9Profile0*) no_gpu_encoder_vp9=;;
+ *VAProfileH264ConstrainedBaseline*) no_gpu_encoder_h264=;;
+ esac
+ if [ -n "$no_gpu_decoder_vp8$no_gpu_decoder_vp9$no_gpu_decoder_h264" ]; then
+ case "$vainfo" in
+# TODO *"Intel iHD driver"*) gpu=qsv;;
+ *) gpu=vaapi;;
+ esac
+ fi
esac
fi
case "$gpu" in
@@ -548,7 +567,7 @@ for vformat in vp8 vp9 h264; do
eval "[ -z \"$no_q\$no_q_$vformat\" ] || q_$vformat="
[ -z "$q" ] || eval "q_$vformat=$q"
eval "[ -n \"\$q_$vformat\" ] || no_q_$vformat=yes"
- [ -z "$gpu" ] || eval "encoder_$vformat=${vformat}_$gpu"
+ [ -z "$gpu" ] || eval "[ -n \"\$no_gpu_encoder_$vformat\" ] || encoder_$vformat=${vformat}_$gpu"
# melt supports dual-pass only for h.264
[ h264 = "$vformat" ] || [ -n "$vpxenc" ] || eval "[ -z \"$multipass\" ] || use_ffmpeg_$vformat=yes"