## ¿Qué es AVIF?
**AVIF** (AV1 Image File Format) es un formato de imagen moderno basado en el codec AV1, desarrollado por la Alliance for Open Media (AOMedia). Logra una compresión aún más eficiente que WebP: típicamente **20-50% más pequeño que WebP** a calidad visual equivalente, y completamente libre de royalties.
## AVIF vs WebP vs JPG
| Métrica | JPG | WebP | **AVIF** |
|---------|-----|------|---------|
| Compresión | Referencia | +25% mejor | **+40-50% mejor** |
| Transparencia | ❌ | ✅ | ✅ |
| HDR y amplio gamut | ❌ | Limitado | ✅ |
| Profundidad de color | 8 bits | 8 bits | **10-12 bits** |
| Soporte (2024) | Universal | 96%+ | **93%+** |
*Fotografía 1200×800 px: JPG 180 KB → WebP 130 KB → **AVIF 85 KB** (-53% vs JPG)*
## Convertir a AVIF con FFmpeg
```bash
ffmpeg -i foto.jpg -c:v libaom-av1 -crf 30 -b:v 0 foto.avif
ffmpeg -i foto.jpg -c:v libsvtav1 -crf 35 foto.avif # más rápido
```
CRF 25-35 es el balance óptimo para web.
## Convertir con Squoosh CLI
```bash
npx @squoosh/cli --avif '{"cqLevel": 33, "speed": 4}' foto.jpg
```
## Convertir con Python
```bash
pip install pillow pillow-avif-plugin
```
```python
import pillow_avif
from PIL import Image
Image.open("foto.jpg").save("foto.avif", quality=80)
```
## Implementar con fallback
```html
```
## Soporte en navegadores (2024)
Chrome 85+, Firefox 93+, Edge 121+, Safari 16+. **93%+ cobertura global.**
## Servir AVIF desde el servidor
```apache
AddType image/avif .avif
```
```nginx
types { image/avif avif avifs; }
```
## Conclusión
AVIF es el formato más eficiente para imágenes web en 2024. Con 93%+ de soporte, usa `` con fallback a WebP y JPG para máxima compatibilidad.