Email or username:

Password:

Forgot your password?
64 posts total
sss
#script #note #hint #ffmpeg #av1 #avif #encoding #photo

so it seems we finally got some fast avif encoder with acceptable quality?
here is a quick and dirty script to encode images into avif format using av1_qsv video encoder via ffmpeg

```
#!/bin/sh

FILE=$(basename "$1")
EXT="${FILE##*.}"
TGT_EXT="avif"

echo -e "\E[32mfile with ext: $EXT\n"

IPARAMS=(
"-hide_banner" "-threads" "0"
# "-hwaccel" "qsv"
# "-hwaccel_output_format" "qsv"
"-init_hw_device" "qsv=hw:hw_any,name=hw" "-filter_hw_device" "hw"
)


OPARAMS=(
"-strict" "experimental"
"-c:v" "av1_qsv"

"-preset:v" "veryslow"
"-extbrc:v" "1"
"-low_power:v" "false"
"-low_delay_brc" "false"
"-q:v" "66"

"-color_primaries:v" "bt2020" "-colorspace:v" "bt2020c"
)

echo "ffmpeg ${IPARAMS[@]} -i "$1" ${OPARAMS[@]} "$1".${TGT_EXT}"
ffmpeg ${IPARAMS[@]} -i "$1" ${OPARAMS[@]} "$1".${TGT_EXT}
if [ $? != 0 ]; then
echo -e "\E[31mShit happened"
exit $?
fi
exiftool -overwrite_original -tagsFromFile "$1" "$1".${TGT_EXT}


if [ $? == 0 ]; then
rm "$1"
NAME=$(echo "$1" | sed 's/\(.*\)\..*/\1/')
mv "$1".${TGT_EXT} "${NAME}".${TGT_EXT}
/home/sss/scripts/syncfs "${NAME}".${TGT_EXT}
echo done "${NAME}".${TGT_EXT}
else
echo -e "\E[31mShit happened"
fi


```

it' also possible to use hwaccel for image decoding, but at least mjpeg_qsv is broken for today which leading to corrupt image instead if errors....
#script #note #hint #ffmpeg #av1 #avif #encoding #photo

so it seems we finally got some fast avif encoder with acceptable quality?
here is a quick and dirty script to encode images into avif format using av1_qsv video encoder via ffmpeg
sss
note what it provides files size twice as large as avifenc results with same image quality
Александр
@sss Да разве таким жителя СНГ напугаешь :)
Go Up