From a8897cc7935c19d71dbf6e768244e47a205b8f55 Mon Sep 17 00:00:00 2001 From: Ken Fallon Date: Tue, 24 Dec 2024 13:02:58 +0100 Subject: [PATCH] The magick convert is deprecated --- bin/audio2image.bash | 18 +++++++++--------- bin/duration.bash | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100755 bin/duration.bash diff --git a/bin/audio2image.bash b/bin/audio2image.bash index 954cf82..a5e20d5 100755 --- a/bin/audio2image.bash +++ b/bin/audio2image.bash @@ -54,20 +54,20 @@ trap 'cleanup_temp $TMP1' SIGHUP SIGINT SIGPIPE SIGTERM EXIT ffmpeg -v 0 -analyzeduration 900000000000 -probesize 200M -threads 2 -i "$AUDIO" \ -filter_complex aformat=channel_layouts=mono,showwavespic=colors=white:s=3200x800 \ -frames:v 1 -f apng - 2>/dev/null | \ - magick convert - -background black -alpha remove -alpha off "$TMP1" 2>/dev/null | cat > /dev/null 2>&1 + magick - -background black -alpha remove -alpha off "$TMP1" 2>/dev/null | cat > /dev/null 2>&1 # # Not clear what's being done to the image here, but it produces a useful end # result, or seems to! # -magick convert -background black "$TMP1" -gravity center -background black -transparent white - | \ - magick convert - -gravity South -background white -splice 0x5 -background black -splice 0x5 - | \ - magick convert - -trim - | \ - magick convert - -gravity South -chop 0x5 - | \ - magick convert - -gravity North -background white -splice 0x5 -background black -splice 0x5 - | \ - magick convert - -trim - | \ - magick convert - -gravity North -chop 0x5 - | \ - magick convert - -resize '800x200!' "$IMAGE" +magick -background black "$TMP1" -gravity center -background black -transparent white - | \ + magick - -gravity South -background white -splice 0x5 -background black -splice 0x5 - | \ + magick - -trim - | \ + magick - -gravity South -chop 0x5 - | \ + magick - -gravity North -background white -splice 0x5 -background black -splice 0x5 - | \ + magick - -trim - | \ + magick - -gravity North -chop 0x5 - | \ + magick - -resize '800x200!' "$IMAGE" # # The original renamed the temporary file to be the target image file, but diff --git a/bin/duration.bash b/bin/duration.bash new file mode 100755 index 0000000..5448931 --- /dev/null +++ b/bin/duration.bash @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright Ken Fallon - Released into the public domain. http://creativecommons.org/publicdomain/ +find ${HOME}/processing/ -type f | egrep -v '/sponsor-anhonesthost.com-hpr15.flac|/outro.flac|/intro.flac|/sponsor-archive.org.flac' | while read mediafile +do + duration=$( mediainfo --full --Output=XML "${mediafile}" | xmlstarlet sel -T -t -m "_:MediaInfo/_:media/_:track[@type='Audio']/_:Duration[1]" -v "." -n - | awk -F '.' '{print $1}' ) + if [ "${duration}" != "" ] + then + echo "${mediafile}: ${duration}" + continue + fi + duration=$( /bin/date -ud "1970-01-01 $( ffprobe -i "${mediafile}" 2>&1| awk -F ': |, ' '/Duration:/ { print $2 }' )" +%s ) + if [ "${duration}" != 0 ] + then + echo "${mediafile}: ${duration}" + continue + fi +done