ESP32-S3 MJPEG Video Player
A high-performance media player for the ESP32-S3 capable of playing MJPEG video with synchronized I2S audio. It features a menu-driven interface, utilizes an SD card for storage, and leverages PSRAM to ensure smooth playback on ST7789 displays.
The ESP32-S3 MJPEG Video Player is a sophisticated implementation of multimedia playback on a microcontroller, pushing the boundaries of what is typically expected from the ESP32-S3 platform. By combining high-speed JPEG decoding with I2S audio output, this project creates a compact, functional video player capable of smooth playback and synchronized sound.
The system architecture revolves around the ESP32-S3, specifically the variant equipped with 8MB of PSRAM. This additional memory is critical for buffering video frames, ensuring that the transition between frames remains fluid even at higher resolutions. The project targets the ST7789 TFT display, a popular choice for small-scale embedded graphics, driven by the highly optimized TFT_eSPI library.
Hardware Integration and Audio
Beyond just visual output, the player incorporates a full audio stack using an I2S amplifier, such as the MAX98357. This allows for digital-to-analog conversion and amplification to a dedicated speaker, providing a complete cinematic experience in a handheld form factor. The project uses a standard Micro SD card module via SPI for file storage, allowing users to load multiple video files onto the device.
User interaction is handled through a simple but effective three-button interface. These buttons allow for navigating a scrollable menu to select videos and controlling playback. The logic is designed to be responsive, with the “Play” button serving as both a selection tool in the menu and a stop command during active video playback.
The MJPEG Pipeline
One of the technical highlights of this project is the video conversion pipeline. Since raw MP4 or AVI files are too computationally intensive for direct decoding on most microcontrollers, the project utilizes a custom Python-based converter. This script transforms standard video formats into MJPEG (Motion JPEG) files. During this process, the video is resized to fit the 240x280 resolution of the ST7789 display, ensuring that the ESP32-S3 can decode the frames in real-time using the JPEGDEC library.
Software Configuration
The software relies heavily on the correct configuration of the TFT_eSPI library. Users must define their specific pin mappings for the SPI interface (CS, DC, RST, MOSI, and SCLK) within the library’s header files. This level of customization allows the project to be adapted to various ESP32-S3 development boards and display modules.
The main Arduino sketch coordinates the interaction between the SD card file system, the JPEG decoder, and the I2S audio buffer. By managing these resources efficiently, the player avoids stuttering and maintains audio-video synchronization, which is often a significant hurdle in embedded media projects.
Technical Specifications
- Microcontroller: ESP32-S3 (PSRAM version recommended)
- Display: ST7789 TFT (240x280 resolution)
- Audio Output: I2S via MAX98357 and speaker
- Storage: Micro SD Card (FAT32 formatted)
- Input: 3x Tactile buttons for navigation and playback
- Libraries: TFT_eSPI for rendering and JPEGDEC for hardware-accelerated decoding
This project serves as an excellent demonstration of the ESP32-S3’s capabilities in handling concurrent high-speed SPI communication, memory-intensive decoding, and real-time audio streaming.