Fix quoting for file inputs in transcoding functions

This commit is contained in:
David Heinemeier Hansson
2026-02-26 12:00:08 +01:00
parent 35862eb907
commit cc3d8e4abe
+9 -8
View File
@@ -1,11 +1,11 @@
# Transcode a video to a good-balance 1080p that's great for sharing online
transcode-video-1080p() {
ffmpeg -i $1 -vf scale=1920:1080 -c:v libx264 -preset fast -crf 23 -c:a copy ${1%.*}-1080p.mp4
ffmpeg -i "$1" -vf scale=1920:1080 -c:v libx264 -preset fast -crf 23 -c:a copy "${1%.*}-1080p.mp4"
}
# Transcode a video to a good-balance 4K that's great for sharing online
transcode-video-4K() {
ffmpeg -i $1 -c:v libx265 -preset slow -crf 24 -c:a aac -b:a 192k ${1%.*}-optimized.mp4
ffmpeg -i "$1" -c:v libx265 -preset slow -crf 24 -c:a aac -b:a 192k "${1%.*}-optimized.mp4"
}
# Transcode any image to JPG image that's great for shrinking wallpapers
@@ -13,22 +13,23 @@ img2jpg() {
img="$1"
shift
magick "$img" $@ -quality 95 -strip ${img%.*}-converted.jpg
magick "$img" "$@" -quality 95 -strip "${img%.*}-converted.jpg"
}
# Transcode any image to JPG image that's great for sharing online without being too big
# Transcode any image to a small JPG (max 1080px wide) that's great for sharing online
img2jpg-small() {
img="$1"
shift
magick "$img" $@ -resize 1080x\> -quality 95 -strip ${img%.*}-small.jpg
magick "$img" "$@" -resize 1080x\> -quality 95 -strip "${img%.*}-small.jpg"
}
# Transcode any image to JPG image that's great for sharing online without being too big
# Transcode any image to a medium JPG (max 1800px wide) that's great for sharing online
img2jpg-medium() {
img="$1"
shift
magick "$img" $@ -resize 1800x\> -quality 95 -strip ${img%.*}-medium.jpg
magick "$img" "$@" -resize 1800x\> -quality 95 -strip "${img%.*}-medium.jpg"
}
# Transcode any image to compressed-but-lossless PNG
@@ -36,7 +37,7 @@ img2png() {
img="$1"
shift
magick "$img" $@ -strip -define png:compression-filter=5 \
magick "$img" "$@" -strip -define png:compression-filter=5 \
-define png:compression-level=9 \
-define png:compression-strategy=1 \
-define png:exclude-chunk=all \