Última actualización: 30 Jun, 2026

TL;DR – AVI (Audio Video Interleave) es el primer contenedor de “video digital” de Microsoft, nacido con Windows 95. Es un archivo simple basado en RIFF que entrelaza fragmentos de video y audio comprimidos para que un reproductor los lea en sincronía. El formato aún es reconocido por Windows Media Player y una gran cantidad de herramientas de código abierto, pero carece de características modernas como HDR, color de 10 bits y metadatos de transmisión robustos. Si alguna vez necesitas profundizar en material legado, comprender la disposición de los fragmentos, los códigos FourCC y las extensiones OpenDML que eliminan el límite de 2 GB – eso es lo esencial de AVI.
1. ¿Qué es exactamente un archivo AVI?
- Nombre completo: Audio Video Interleave
- Primera aparición: Windows 95 (1995) – La respuesta de Microsoft al “video digital” en el PC de consumo.
- Especificación: Basado en la especificación RIFF (Resource Interchange File Format) de 1991. RIFF es un contenedor genérico “basado en fragmentos”; AVI simplemente define un conjunto de fragmentos que contienen audio, video y datos de indexación.
- Extensión de archivo / MIME:
.avi–video/x-msvideo. - Objetivo principal: Mantener los flujos de audio y video estrechamente entrelazados en el disco para que un bucle de reproducción ingenuo pueda leer un fotograma de video y luego la muestra de audio correspondiente, sin búsquedas costosas.
- Estado legado: Aún reproducible en Windows Media Player, DirectShow, VLC y un sinfín de otros reproductores, pero no es un contenedor “modern”. No tiene soporte nativo para HDR, 10 bits, tasa de bits variable o metadatos enriquecidos.
2. Dentro de la caja – Cómo funciona AVI
El esqueleto de bloques RIFF
Un archivo AVI es simplemente una serie de chunks:
RIFF <size> "AVI " ; file header
LIST "hdrl" ; header list
avih ... ; main AVI header (global info)
LIST "strl" ; stream list (one per stream)
strh ... ; stream header (type, codec, timing)
strf ... ; stream format (codec‑specific data)
LIST "movi" ; interleaved media data
00dc <size> <video frame>
01wb <size> <audio block>
…
idx1 ... ; optional index for fast seeking
- ID de chunk (4 bytes) – p. ej.,
avih,strh,movi. - Tamaño del chunk (4 bytes) – longitud de los datos que siguen (excluyendo los campos de ID y tamaño).
- Datos – la carga útil real (encabezados, fotogramas sin procesar, etc.).
Debido a que RIFF es extensible, puedes añadir nuevos tipos de chunk sin romper los analizadores más antiguos, un diseño que mantuvo vivo a AVI durante décadas.
FourCC – El susurrador de códecs
Los códigos de cuatro caracteres (FourCC) son el pegamento que indica a un reproductor qué decodificador cargar. Algunos comunes que verás en archivos AVI:
| FourCC | Códec (ffmpeg) | Uso típico |
|---|---|---|
DIVX | mpeg4 (DivX) | MPEG‑4 Parte 2 temprana |
XVID | mpeg4 (Xvid) | MPEG‑4 de código abierto |
MJPG | mjpeg | Motion‑JPEG (cámaras de video digitales) |
H264 | h264 | H.264/AVC (raro pero posible) |
MP3 | mp3 | Transmisión de audio MP3 |
PCM | pcm_s16le | Audio PCM sin comprimir |
El FourCC se encuentra en el bloque strh (identificador de códec) y a veces en el bloque strf (formato de píxel, formato de muestra de audio).
Temporización y sincronización
AVI utiliza un sistema simple de base de tiempo:
- Encabezado global (
avih):dwRate/dwScale→ fotogramas por segundo. - Encabezado por flujo (
strh): su propiodwRate/dwScalepara audio o flujos de video secundarios.
El reproductor multiplica el número de fotograma por scale/rate para calcular una marca de tiempo de presentación (PTS). Si las escalas no coinciden, verás el clásico error “el audio se desincroniza” que persigue a las herramientas heredadas.
El bloque movi – Donde vive el medio
Todos los fotogramas comprimidos se encuentran en la LISTA movi. Cada fotograma está precedido por un ID de bloque que indica si es video (00dc) o audio (01wb). El ID también codifica el número de flujo, de modo que un archivo con dos pistas de audio tendría 01wb y 02wb.
Debido a que los datos ya están entrelazados, un reproductor puede leer un fotograma de video, luego el siguiente bloque de audio, y presentarlos juntos sin buscar mucho hacia adelante. Ese patrón de escritura determinista hizo que AVI fuera popular para los dispositivos de captura tempranos que necesitaban escrituras en disco de baja latencia.
Indexación (idx1) – Avance rápido, retroceso rápido
El bloque opcional idx1 es una tabla de desplazamientos y tamaños para cada fotograma en movi. Cuando está presente, la búsqueda es una simple consulta a la tabla. Si falta, los reproductores deben escanear el archivo en tiempo real, lo que puede provocar una pausa de “buffering” notable en archivos grandes.
OpenDML (AVI 2.0) – Rompiendo la barrera de 2 GB
La especificación original de RIFF limita el campo de tamaño de un chunk a un entero sin signo de 32‑bits → 2 GB de tamaño máximo de archivo. OpenDML (a veces llamado AVI 2.0) introdujo:
AVIXLISTs – secciones RIFF “extendidas” adicionales que pueden seguir a los primeros 2 GB.indxchunk – un índice compatible con 64‑bits.- Campos de encabezado extra para duraciones más largas.
La mayoría de las herramientas modernas (ffmpeg, VLC) cambian automáticamente a OpenDML cuando la salida supera los 2 GB, pero muchos reproductores antiguos todavía fallan con los chunks AVIX, por lo que a veces verás trucos de compatibilidad que dividen una captura larga en varios archivos AVI de 2 GB.
3. ¿Dónde vive AVI en 2024?
| Tendencia | Qué Significa para AVI |
|---|---|
| Cambio a MP4/MKV/ProRes | Las nuevas producciones favorecen contenedores que soportan nativamente HDR, 10‑bit, VBR y metadatos ricos. AVI rara vez se elige para contenido nuevo. |
| Hardware heredado | Cámaras CCTV antiguas, videocámaras de principios de los 2000 y algunos motores de juego todavía generan AVI. Aún necesitarás ingerir esos archivos en un flujo de trabajo moderno. |
| Soporte de código abierto | ffmpeg, libav, VLC, HandBrake y GStreamer mantienen los analizadores AVI activos, pero a menudo re‑codifican a MP4/MKV para distribución. |
| Resurgimiento de OpenDML | Las grabaciones de vigilancia 4K que se ejecutan durante días superan rápidamente los 2 GB. OpenDML (AVIX) sigue siendo la solución preferida, aunque muchas herramientas lo manejan incorrectamente. |
| Refuerzo de seguridad | Los analizadores históricos de AVI aceptaban tamaños de fragmentos malformados, lo que provocaba CVE (p. ej., CVE‑2020‑13144). Windows ahora prefiere Media Foundation, que rechaza muchas peculiaridades heredadas, empujando a los desarrolladores hacia canalizaciones más seguras. |
| Canalizaciones agnósticas al contenedor | Los marcos de medios modernos tratan AVI como simplemente otro elemento de origen. Una vez que los datos se demultiplexan en búferes crudos, el contenedor deja de ser relevante para el procesamiento posterior. |
En resumen, AVI está vivo pero envejeciendo – sobrevive donde se requiere hardware antiguo o almacenamiento intercalado simple, pero no es la primera opción para proyectos nuevos.
4. Práctico: Trabajando con AVI hoy
A. Vista previa de un encabezado mínimo (hex)
52 49 46 46 00 00 00 00 41 56 49 20 ; "RIFF" + size + "AVI "
4C 49 53 54 20 00 00 00 68 64 72 6C ; LIST "hdrl"
...
El magic RIFF (52 49 46 46) indica a cualquier analizador “este es un archivo RIFF”. Los siguientes cuatro bytes son el tamaño total del archivo (menos 8). El identificador "AVI " bloquea el archivo dentro de la familia AVI.
B. Conversión de MP4 Moderno → AVI Legado
ffmpeg -i input.mp4 \
-c:v mpeg4 -q
```bash
ffmpeg -i input.mp4 \\ \n -c:v mpeg4 -qscale:v 5 \\ \n # MPEG‑4 Parte 2 (compatible con DivX/Xvid) -c:a mp3 -b:a 192k \\ \n # audio MP3 (la mayoría de los reproductores AVI lo entienden) -f avi output.avi
The command above forces MPEG‑4 Part 2 video (the codec most legacy AVI players recognize) and MP3 audio, then writes an AVI container. If you need OpenDML support for files larger than 2 GB, add the -movflags +faststart‑style flag that tells FFmpeg to use the extended AVIX chunks:
ffmpeg -i input.mp4 \\ -c:v mpeg4 -qscale:v 5 \\ -c:a mp3 -b:a 192k \\ -f avi -flags +global_header -movflags +faststart output.avi
Tip: Some older Windows Media Player versions still choke on the
AVIXextension. If you must stay under 2 GB, split the source into multiple AVIs using the-segment_timeand-f segmentmuxer.
5. Common Pitfalls & How to Fix Them
| Symptom | Likely Cause | Fix |
|---|---|---|
| Audio drifts out of sync after a few minutes | Mismatched dwRate/dwScale between avih and strh (or a VBR audio stream) | Re‑encode audio to a constant‑bitrate format (e.g., MP3 128 kbps) or use -vsync 2 in FFmpeg to force frame‑accurate timestamps. |
| “Cannot play this video” on Windows Media Player | Missing or corrupt idx1 index, or OpenDML (AVIX) chunks not recognized | Run ffmpeg -i broken.avi -c copy -map 0 -f avi repaired.avi to rebuild the index; or use aviindex (part of mplayer) to generate a fresh idx1. |
| File size capped at 2 GB despite long footage | Encoder used classic AVI (no OpenDML) | Add -use\_open\_dml 1 (FFmpeg) or -format avi2 (VirtualDub) to enable OpenDML extensions. |
| Green or corrupted frames | Incompatible FourCC (e.g., H.264 in an AVI without proper headers) | Stick to codecs known to work in AVI (mpeg4, msmpeg4v2, MJPG, XVID). If you must store H.264, use the h264 FourCC and ensure the strf chunk contains the SPS/PPS extradata. |
| Playback stalls on network streams | AVI’s lack of robust streaming metadata (no moov atom) | Wrap the AVI in a streaming protocol (e.g., RTSP) that handles byte‑range requests, or convert to MP4/MKV for smoother streaming. |
6. Debugging Tools You Should Keep Handy
| Tool | Platform | What It Does |
|---|---|---|
| ffprobe / ffmpeg | Cross‑platform | Dumps every chunk, FourCC, timestamps, and can rebuild indexes (-c copy). |
| MediaInfo | Windows/macOS/Linux | Human‑readable summary of streams, codecs, and container flags. |
| VirtualDub | Windows | Classic AVI editor; can rebuild headers, add OpenDML, and preview frame‑by‑frame. |
| GSpot (legacy) | Windows | Identifies obscure FourCCs and suggests appropriate codecs. |
| aviindex (part of MPlayer) | Linux/macOS | Generates a fresh idx1 chunk for broken files. |
| Hex editors (HxD, Bless) | Any | Directly inspect RIFF headers when you suspect malformed chunk sizes. |
A typical workflow when an AVI refuses to play:
- Inspect with
ffprobe -show_format -show_streams file.avi. - Check the index:
ffmpeg -i file.avi -c copy -f avi -y temp.avi(FFmpeg will rebuild it automatically). - Validate FourCCs:
mediainfo file.avi. If you see an unknown codec, consider re‑encoding that stream. - Repair with VirtualDub → “File → Re‑open as AVI (OpenDML)”. Save a fresh copy.
7. When (and When Not) to Use AVI
Good Use‑Cases
| Scenario | Why AVI Works |
|---|---|
| Legacy camcorder ingest | The device outputs native AVI; transcoding adds unnecessary quality loss. |
| Simple interleaved capture | Low‑latency write to disk without needing complex container features. |
| Compatibility with old Windows‑only software | Some industrial automation tools only understand AVI. |
| Archiving raw, uncompressed video | AVI can hold PCM audio and uncompressed RGB24 video without extra overhead. |
Bad Use‑Cases
| Scenario | Why AVI Fails |
|---|---|
| HDR or 10‑bit color | No standard way to store those pixel formats; you’d need a custom FourCC that most players ignore. |
| Variable‑bit‑rate streaming | Lack of a proper moov‑like atom makes adaptive bitrate impossible. |
| Rich metadata (chapters, subtitles, tags) | AVI’s chunk model doesn’t define standard containers for subtitles or extensive tags. |
| Cross‑platform mobile distribution | Modern mobile players expect MP4/MKV; AVI may not be hardware‑accelerated. |
If you’re starting a new project, treat AVI as a fallback for legacy pipelines, not a primary delivery format.
8. Future Outlook – Will AVI Ever Make a Comeback?
The short answer: unlikely. The industry has coalesced around ISO‑BMFF‑based containers (MP4, MOV, HEVC‑MP4, etc.) because they support:
- Extensible metadata (ISO‑UserData, UUID boxes).
- Fragmented streaming (moof/mdat) for adaptive bitrate.
- Native HDR/10‑bit/12‑bit video definitions.
AVI’s design, while elegant for its time, is fundamentally limited by its 32‑bit size fields and its reliance on external FourCC‑driven codecs. Even though OpenDML extended the size limit, it never gained widespread adoption beyond niche surveillance and archival tools.
That said, software preservation will keep AVI parsers alive for decades. Projects like FFmpeg, GStreamer, and VLC will continue to support the format, ensuring that the massive archive of 1990s‑2000s footage remains accessible. In a world where “digital archaeology” is becoming a real discipline, knowing how to read and repair AVI files is still a valuable skill.
9. Quick Reference Cheat‑Sheet
| Item | Command / Setting | Explanation |
|---|---|---|
| Create classic AVI | ffmpeg -i src -c:v mpeg4 -qscale:v 5 -c:a mp3 -b:a 192k -f avi out.avi | Simple, widely compatible. |
| Enable OpenDML | ffmpeg -i src -c:v mpeg4 -qscale:v 5 -c:a mp3 -b:a 192k -f avi -use_open_dml 1 out.avi | Allows >2 GB files. |
| Re‑index broken AVI | ffmpeg -i broken.avi -c copy -f avi repaired.avi | Rewrites idx1. |
| Split >2 GB into chunks | ffmpeg -i long.avi -c copy -map 0 -segment_time 1800 -f segment part_%03d.avi | 30‑minute segments stay under the limit. |
| Inspect header | ffprobe -show_format -show_streams file.avi | Dumps all RIFF chunks and stream info. |
| Add a subtitle track (non‑standard) | ffmpeg -i video.avi -i subs.srt -c copy -metadata:s:s:0 language=eng out.avi | Works only with players that read the txt stream; not universally supported. |
Keep this table bookmarked; it covers 80 % of everyday AVI tasks.
10. Best Practices for Archiving AVI Files
Even though AVI is a legacy container, many institutions still have petabytes of it sitting on tape or in cold‑storage. Treating those assets with a disciplined workflow will save you headaches down the line.
| Practice | Why It Matters | How to Implement |
|---|---|---|
| Validate on ingest | Corrupt headers or missing indexes can go unnoticed until playback. | Run ffprobe -v error -show_format -show_streams file.avi immediately after copying. Log any non‑zero exit codes. |
| Generate a checksum | Guarantees bit‑exact preservation across media migrations. | Use SHA‑256 (sha256sum file.avi > file.avi.sha256). Store the checksum alongside the file in your catalog. |
| Create a modern proxy | Most downstream workflows (editing, streaming) expect MP4/MKV. | Encode a low‑bitrate MP4 proxy (ffmpeg -i file.avi -c:v libx264 -crf 23 -c:a aac -b:a 128k proxy.mp4). Keep the proxy in the same directory with a clear naming convention (*_proxy.mp4). |
| Document FourCCs and codec versions | Some FourCCs map to multiple codec implementations (e.g., DIVX could be DivX 5, 6, or 7). | Extract the codec private data (ffprobe -show_private_data) and store it in a side‑car JSON file (file.avi.codec.json). |
| Migrate to OpenDML for large files | Files >2 GB will become unreadable on older players. | When transcoding, always pass -use_open_dml 1. If you’re only copying, use aviindex to rebuild an OpenDML‑compatible index. |
| Store metadata in a side‑car | AVI has no standard for extensive tags (e.g., creator, location). | Use XMP side‑car files (file.avi.xmp) or embed a small INFO LIST chunk manually if you need minimal in‑container metadata. |
| Regularly test playback | Bit‑rot can affect codecs as well as containers. | Schedule a quarterly job that runs a headless player (e.g., ffplay -autoexit -frames 10 file.avi) and reports any failures. |
By applying these steps at the moment of acquisition, you avoid costly “repair‑the‑archive” projects later.
11. Frequently Asked Questions (FAQ)
Q1: Can I store H.265/HEVC video inside an AVI file?
Short answer: Technically yes, if you supply the correct FourCC (HEVC or HVC1) and include the SPS/PPS NAL units in the strf chunk. In practice, very few players support it, and many will treat the stream as unknown. For reliable playback, stick to MPEG‑4 Part 2 or Motion‑JPEG.
Q2: Why does Windows Media Player sometimes show a black screen but still plays audio?
Explanation: The player has successfully opened the audio stream but failed to locate a usable video decoder for the FourCC. This can happen when the FourCC is custom or when the required codec isn’t installed. Installing a codec pack (e.g., K-Lite) or re‑encoding the video to a known FourCC resolves the issue.
Q3: Is there any way to embed subtitles directly into an AVI file?
Answer: AVI does not define a standard subtitle stream. Some tools cheat by adding a “txt” stream (FourCC txt ) that contains plain‑text subtitles, but only a handful of players (e.g., VirtualDub with a plugin) will render them. The recommended approach is to keep subtitles in a separate .srt or .ass file, or to re‑mux into a container that officially supports subtitles (MP4, MKV).
Q4: My video shows a “frame rate mismatch” warning in MediaInfo. What should I do?
Solution: Verify that the dwRate/dwScale values in both the global avih and per‑stream strh headers are consistent. If they differ, re‑mux with FFmpeg using -video_track_timescale to force a uniform time base:
ffmpeg -i broken.avi -c copy -video_track_timescale 1000 fixed.avi
Q5: Does AVI support multiple audio languages?
Yes, but with caveats. You can add several audio streams, each with its own strh/strf pair and a distinct stream number (01wb, 02wb, …). However, there is no standardized way to label the language; you must rely on external metadata (e.g., an accompanying .xml file) or embed a custom INFO chunk.
Q6: How can I extract raw frames from an AVI without re‑encoding?
Command:
ffmpeg -i source.avi -c:v copy -f image2 frame_%05d.bmp
Replace bmp with png or tiff if you prefer lossless image formats. The -c:v copy flag tells FFmpeg to dump the compressed frames as‑is; if the codec is MJPEG, the output will already be JPEG images.
Q7: Are there any security concerns when opening AVI files from untrusted sources?
Yes. Malformed chunk sizes can trigger buffer overflows in legacy parsers (e.g., older DirectShow filters). Always open unknown AVIs in a sandboxed environment or use a modern library like FFmpeg that performs strict bounds checking. Updating Windows Media Foundation and disabling legacy DirectShow filters further mitigates risk.
12. Resumen TL;DR (para los impacientes)
- AVI = RIFF‑based, interleaved container introduced with Windows 95.
- FourCC tells the player which codec to use; common ones are
DIVX,XVID,MJPG,H264,MP3. - Timing is driven by
dwRate/dwScalein the global and stream headers. moviholds the actual media;idx1(optional) speeds up seeking.- OpenDML (
AVIX) lifts the 2 GB limit but isn’t universally supported. - Use cases today: legacy camcorder ingest, simple interleaved capture, archival of raw PCM video.
- Avoid for new projects: no HDR, 10‑bit, VBR, subtitles, or rich metadata.
- Toolbox:
ffprobe,ffmpeg, MediaInfo, VirtualDub, aviindex, hex editors. - Best practice: validate, checksum, generate modern proxies, and migrate large files to OpenDML.
13. Reflexiones Finales
AVI’s simplicity is both its strength and its Achilles’ heel. It gave early PC users a straightforward way to store synchronized audio‑video pairs, and that design philosophy—interleaved chunks, a clear header layout, and extensible FourCC identifiers—still influences modern containers. While the industry has moved on to more feature‑rich formats, the sheer volume of legacy footage means AVI will remain a “must‑know” for anyone working in video preservation, forensic analysis, or any field that must bridge the past with today’s workflows.
If you ever find yourself staring at a dusty .avi on a hard drive from the late‑90s, you now have the conceptual map, the command‑line recipes, and the troubleshooting checklist to bring that footage back to life—whether you choose to keep it in its original container or transcode it into a modern, HDR‑ready format.
Happy demuxing!