cancel
Showing results for 
Search instead for 
Did you mean: 

Video Decoding MP4 Format

rachitjuthani
Associate

Hello,

 

I have an 1024x600 resolution 7 inch TFT screen.

I will be taking data from my GSM module and storing it in eMMC memory.

I want to display videos playing on the 7 inch display.

The raw frames even of 10sec becomes huge in size . So we are planning to use MP4 format. The size of the file reduces drastically. We want to decode these files and display the data.

If I am correct I should use H.264 decoder for this right?

Is there any ST MCU THAT CAN DO THIS?

We want the device to start quickly when powered. Is there any crossover series that has H.264 DECODER IN MCU itself will be useful.

 

Any suggestion are welcome.

1 ACCEPTED SOLUTION

Accepted Solutions
ahsrabrifat
Senior II

Yes, MP4 normally means you will be dealing with H.264 video in many cases, but the important point is that decoding H.264 is not a simple MCU task.

For a 1024x600 display, software decoding H.264 on a normal STM32 MCU is not realistic, especially if you want smooth playback and fast startup. You need either:

  1. A device with a hardware video decoder

  2. A Linux-capable MPU

  3. Or an external video decoder / multimedia chip

Most STM32 MCUs, including STM32H7, do not have an H.264 hardware decoder. Some parts have JPEG acceleration, DMA2D, LTDC, Chrom-ART, etc., but that helps with graphics/framebuffer handling, not MP4/H.264 decoding.

STM32N6 has H.264 hardware encoder, but encoder is not the same as decoder. If your requirement is to play MP4 files, you specifically need H.264 decoding support.

For this type of application, I would look more toward STM32MP1/MP2 series or another MPU running Linux, because then you can use GStreamer/FFmpeg/video frameworks and hardware multimedia blocks where available. Startup time will be slower than a bare-metal MCU, but it is the more realistic architecture for MP4 video playback.

If quick boot is very important, another option is to avoid MP4 and use a simpler format, such as MJPEG or a sequence of compressed JPEG frames. File size will be larger than H.264, but decoding is much easier on MCU hardware.

So in short: for STM32 MCU only, MP4/H.264 playback on 1024x600 is probably not a good fit. Use an MPU with video decode support, or change the video format to something simpler.

https://www.st.com/en/microcontrollers-microprocessors/stm32n6-series.html (discusses video playback on STM32MP devices)

 

View solution in original post

4 REPLIES 4
Andrew Neil
Super User

Some ideas here: STM32F746G-DISCO, TouchGFX, play video ?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
ahsrabrifat
Senior II

Yes, MP4 normally means you will be dealing with H.264 video in many cases, but the important point is that decoding H.264 is not a simple MCU task.

For a 1024x600 display, software decoding H.264 on a normal STM32 MCU is not realistic, especially if you want smooth playback and fast startup. You need either:

  1. A device with a hardware video decoder

  2. A Linux-capable MPU

  3. Or an external video decoder / multimedia chip

Most STM32 MCUs, including STM32H7, do not have an H.264 hardware decoder. Some parts have JPEG acceleration, DMA2D, LTDC, Chrom-ART, etc., but that helps with graphics/framebuffer handling, not MP4/H.264 decoding.

STM32N6 has H.264 hardware encoder, but encoder is not the same as decoder. If your requirement is to play MP4 files, you specifically need H.264 decoding support.

For this type of application, I would look more toward STM32MP1/MP2 series or another MPU running Linux, because then you can use GStreamer/FFmpeg/video frameworks and hardware multimedia blocks where available. Startup time will be slower than a bare-metal MCU, but it is the more realistic architecture for MP4 video playback.

If quick boot is very important, another option is to avoid MP4 and use a simpler format, such as MJPEG or a sequence of compressed JPEG frames. File size will be larger than H.264, but decoding is much easier on MCU hardware.

So in short: for STM32 MCU only, MP4/H.264 playback on 1024x600 is probably not a good fit. Use an MPU with video decode support, or change the video format to something simpler.

https://www.st.com/en/microcontrollers-microprocessors/stm32n6-series.html (discusses video playback on STM32MP devices)

 

Hi,

Thank you for detailed explanation.

I would like to understand how much memory difference can I observe if using MP4 vs MJPEG ?

Is there any way to calculate it?

There isn't a fixed ratio because it depends heavily on the video content, frame rate, quality settings, and resolution.

As a rough example, for a 1024×600 video at around 30 FPS:

  • MJPEG stores each frame as an individual JPEG image.

  • H.264 (inside an MP4 container) stores keyframes plus only the differences between frames.

Because of this, H.264 is usually much more efficient.

In many practical applications, the same video encoded with H.264 can be anywhere from 5x to 20x smaller than an MJPEG version while maintaining similar visual quality. For videos with relatively static scenes (menus, monitoring screens, dashboards, etc.), the difference can be even larger.

For your use case, I would suggest taking a short sample video (10-20 seconds) and encoding it both ways. The resulting file sizes will give you a much more accurate estimate than any theoretical calculation.

One other thing to consider is memory versus processing power. MJPEG requires significantly more storage, but decoding is much simpler because each frame is essentially just a JPEG image. H.264 saves a lot of storage space, but the decoder is much more computationally demanding, which is why hardware video decoding becomes important.

Out of curiosity, are these videos preloaded into the eMMC during manufacturing, or will they be downloaded over the GSM connection in the field? That may influence whether storage size or decoding complexity is the more important constraint.

Useful resources: (if you want to get in-depth calculations)

https://en.wikipedia.org/wiki/Motion_JPEG

https://en.wikipedia.org/wiki/Advanced_Video_Coding