Created
June 2, 2025 01:22
-
-
Save JupyterJones/0a6a1a75329fac3503e9c69d25326476 to your computer and use it in GitHub Desktop.
convert a directory of avif files to jpg using docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CONV is ffmpeg via docker | |
Path=$1 | |
echo "Processing directory: $Path" | |
# Ensure the path ends with a slash | |
if [[ "$Path" != */ ]]; then | |
Path="$Path"/ | |
fi | |
# Loop through all .avif files in the specified directory | |
for i in "$Path"*.avif; do | |
if [[ -f "$i" ]]; then | |
echo "Converting $i" | |
# Extract the base name without the extension | |
base_name=$(basename "$i" .avif) | |
# Construct the output file name | |
output_file="$Path${base_name}.jpg" | |
# Run the ffmpeg command via Docker | |
docker run -i -u $UID:$GROUPS -v "$PWD:$PWD" -w "$PWD" mwader/static-ffmpeg:5.1.1 -hide_banner -i "$i" "$output_file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment