From 00ef1139ad733351e5fba5b83bc9366624c495e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 4 Oct 2021 22:07:43 +0200 Subject: [PATCH] use ffprobe for reading video meta data, dropping dependency on mplayer --- indexmeta.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/indexmeta.sh b/indexmeta.sh index e37e5da..50d83ef 100644 --- a/indexmeta.sh +++ b/indexmeta.sh @@ -13,22 +13,17 @@ meta_name() { } meta_line() { - local video l w h + local video probe l w h video="$1" [ "${video%.part}" = "$video" -a -s "$video" ] || return 0 - read l h w <<__EOF - $(printf '' \ - | mplayer -input nodefault-bindings -nosound -vo null -identify -frames 0 "$video" 2>&- \ - | sort | sed -rn ' - s:ID_LENGTH=(.*)(\..*)$:\1:p; - s:ID_VIDEO_HEIGHT=(.*):\1:p; - s:ID_VIDEO_WIDTH=(.*):\1:p;' \ - | tr '\n' ' ' - ) -__EOF - printf '%i\t%i\t%i\ttags=\tcomment=\t%s\n' \ - "${l-0}" "${w-0}" "${h-0}" "$(meta_name "$video")" + meta="$(printf \\n; ffprobe -show_entries format=duration:stream=width,height 2>&-)" + l="${probe#*duration=}" l="${l%%${BR}*}" + w="${probe#*width=}" w="${w%%${BR}*}" + h="${probe#*height=}" h="${h%%${BR}*}" + + printf '%i %i %i tags= comment= %s\n' \ + "${l:-0}" "${w:-0}" "${h:-0}" "$(meta_name "$video")" } meta_file(){ -- 2.39.2