albumsetup: better

This commit is contained in:
yosh 2024-01-25 00:44:09 -05:00
parent 8563ac7049
commit e414df3deb
1 changed files with 4 additions and 5 deletions

View File

@ -52,7 +52,6 @@ convert_vid() {
-r 4 \
-b:v 500k \
-c:v libvpx \
-cpu-used -5 \
-deadline realtime \
"$3"
errecho "Successfully converted $2"
@ -73,12 +72,12 @@ extract_cover() {
set -e
# resize within the bounds of 1280x720
# if it's square then make it 722x720 so youtube doesn't make it a short
[ -f "$2" ] && magick mogrify -resize 1280x720 -background black -gravity center -extent 722x720 "$2" || true
[ -f "$2" ] && vipsthumbnail -o "$2" -s '722x720' -c "$2" || true
}
# sets COVER_PIC for use in convert_vid
set_cover() {
COVER_PICTURE="$(mktemp -u)"
COVER_PICTURE="$(mktemp -u -t XXXXXX.png)"
extract_cover "$1" "$COVER_PICTURE"
if [ -f "$COVER_PICTURE" ]; then
:
@ -114,8 +113,8 @@ shift "$((OPTIND - 1))"
mkdir -p "$OUTDIR"
# default cover image, fallback if tracks don't have embedded art
DEFAULT_PICTURE="$(mktemp -u)"
magick convert "$tmpcover" -resize 1280x720 -background black -gravity center -extent 722x720 "$DEFAULT_PICTURE"
DEFAULT_PICTURE="$(mktemp -u -t XXXXXX.png)"
vipsthumbnail -o "$DEFAULT_PICTURE" -s '722x720' -c "$tmpcover"
# copy audio codec if opus since output codec is opus
[ "$EXT" = "opus" ] && acopy="-c:a copy"