I added video support to my AudioTools library: Different container formats can be used to store video on audio together in the same file. Here is a quick overivew of the provided functionality that is relevant for Microcontrollers:
Container Formats
The simplest and therefore most recommended container format is AVI (Audio Video Interleave). It is simple to both encode and decode and you can easily mix audio and video together. It supports both different audio and video encodings.
Sometimes you can also find the MPG (MPEG digital video and audio). As it names states the video is encoded as MPEG-1 (ISO/IEC 11172 part 2) video and the audio as MPEG-1 Layer II (“MP2”) audio but mp3 audio usually works also just fine.
On the desktop you can also find MP4 (formally MPEG-4 Part 14). If you are careful and know what you are doing you can also use it on a Microcontroller. The core issue is that you need to read all the metadata first in order to be able to decode the video and audio and this requires a lot of RAM, or you use some direct access using Files or store the metadata temporarily in some files.
Audio Encoding Formats
Here is an overview of the most frequent audio formats by container format with the most frequently used variant in bold:
| Format | AVI | MPG | MP4 | Description |
|---|---|---|---|---|
| PCM | X | X | uncompressed, high quality, large files | |
| MP3 | X | (X) | very common, lossy compression | |
| AAC | X | X | X | efficient lossy compression |
| ADPCM | X | older compressed audio format | ||
| MP2 | X | MPEG-1 Layer II audio | ||
| Opus | (X) | Codec developed Internet Engineering Task Force (IETF) | ||
| AC-3 | X | (X) | Dolby Digital, common on DVD/broadcast rips – needs codec-ac3 (AC3AudioDecoder) |
PCM files are uncompressed and not only use a lot of space, but also require a lot of bandwidth, so they should be avoided on microcontrollers: However if you prefer to use it anyhow, I suggest to go for 8 bit mono only.
Video Encoding Formats
Here is the corresponding overview for the supported video encoding formats what we can use on Microcontrollers:
| Video Codec | AVI | MPG | MP4 | Description |
|---|---|---|---|---|
| MJPEG | X | X | Motion JEPG (Most efficient format on Microcontrollers | |
| MPEG-2 | X | DVD/broadcast video | ||
| H.264 | (X) | (X) | X | Very common modern video codec |
Further information can be found in the Wiki.
0 Comments