Skip to main content
Associate
October 23, 2024
Question

TouchGFX Error Running Simulator (video in portrait mode limitation?)

  • October 23, 2024
  • 7 replies
  • 2801 views

Hi,

I am working on a pretty simple GUI and everything is working nicely so far.

As soon as I add a video I am getting a compilation error. See below. If I take the video out, everything works.

Since TouchGFX needs mjpeg format, I had to convert my video file into mjpeg. The file works fine in windows. I don't know if it could be from an issue with the format or if there is an actual problem with TouchGFX itself.

What do you guys recommend to generate or convert mjpeg files?

 

 

 

 

Run Simulator
 Generate
 Done
 Generate Assets
 make -f simulator/gcc/Makefile assets -j8
 Reading ./application.config
 Reading ./target.config
 Done
 Post Generate
 touchgfx update_project --project-file=simulator/msvs/Application.vcxproj
 Done
 Compile
 make -f simulator/gcc/Makefile -j8
 Reading ./application.config
 Reading ./target.config
 Compiling generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.cpp
 Compiling generated/gui_generated/src/standby_screen/StandByViewBase.cpp
 Compiling generated/simulator/src/mainBase.cpp
 Compiling generated/fonts/src/Kerning_conthrax_sb_20_4bpp.cpp
 Compiling generated/fonts/src/UnmappedDataFont.cpp
 Compiling generated/fonts/src/Table_conthrax_sb_20_4bpp.cpp
 Compiling generated/fonts/src/FontCache.cpp
 Compiling generated/fonts/src/Font_conthrax_sb_20_4bpp_0.cpp
 Compiling generated/fonts/src/CachedFont.cpp
 Compiling generated/fonts/src/ApplicationFontProvider.cpp
 Compiling generated/images/src/__generated/image_alternate_theme_images_widgets_lineprogress_backgrounds_image_plain_thick_medium_90.cpp
 Compiling generated/images/src/image_BLACK-BG-360px.cpp
 Compiling generated/images/src/SVGDatabase.cpp
 Compiling generated/images/src/BitmapDatabase.cpp
 Compiling generated/texts/src/LanguageGb.cpp
 Compiling generated/texts/src/TypedTextDatabase.cpp
 Compiling generated/texts/src/Texts.cpp
 Compiling simulator/main.cpp
 In file included from generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.cpp:6:0:
 generated/videos/include/videos/VideoDatabase.hpp:8:27: error: expected initializer before '-' token
 const uint32_t video_Power-On_bin_length = 782222;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:10:34: error: expected initializer before '-' token
 extern const uint8_t* video_Power-On_bin_start;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:15:27: error: expected initializer before '-' token
 const uint32_t video_Screensaver_bin_length = 1185126;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:17:34: error: expected initializer before '-' token
 extern const uint8_t* video_Screensaver_bin_start;
 ^
 generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.cpp: In constructor 'ScreensaverViewBase::ScreensaverViewBase()':
 generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.cpp:15:25: error: 'video_Screensaver_bin_start' was not declared in this scope
 video1.setVideoData(video_Screensaver_bin_start, video_Screensaver_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from generated/gui_generated/src/standby_screen/StandByViewBase.cpp:7:0:
 generated/videos/include/videos/VideoDatabase.hpp:8:27: error: expected initializer before '-' token
 const uint32_t video_Power-On_bin_length = 782222;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:10:34: error: expected initializer before '-' token
 extern const uint8_t* video_Power-On_bin_start;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:15:27: error: expected initializer before '-' token
 const uint32_t video_Screensaver_bin_length = 1185126;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:17:34: error: expected initializer before '-' token
 extern const uint8_t* video_Screensaver_bin_start;
 ^
 generated/gui_generated/src/standby_screen/StandByViewBase.cpp: In constructor 'StandByViewBase::StandByViewBase()':
 generated/gui_generated/src/standby_screen/StandByViewBase.cpp:20:25: error: 'video_Power_On_bin_start' was not declared in this scope
 video1.setVideoData(video_Power_On_bin_start, video_Power_On_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~
 generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.cpp:15:60: error: 'video_Screensaver_bin_length' was not declared in this scope
 video1.setVideoData(video_Screensaver_bin_start, video_Screensaver_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 generated/gui_generated/src/standby_screen/StandByViewBase.cpp:20:51: error: 'video_Power_On_bin_length' was not declared in this scope
 video1.setVideoData(video_Power_On_bin_start, video_Power_On_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~
 make[2]: *** [build/MINGW32_NT-6.2/generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.o] Error 1
 generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/generated/gui_generated/src/screensaver_screen/ScreensaverViewBase.o' failed
 make[2]: *** Waiting for unfinished jobs....
 make[2]: *** [build/MINGW32_NT-6.2/generated/gui_generated/src/standby_screen/StandByViewBase.o] Error 1
 generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/generated/gui_generated/src/standby_screen/StandByViewBase.o' failed
 In file included from generated/simulator/src/mainBase.cpp:10:0:
 generated/videos/include/videos/VideoDatabase.hpp:8:27: error: expected initializer before '-' token
 const uint32_t video_Power-On_bin_length = 782222;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:10:34: error: expected initializer before '-' token
 extern const uint8_t* video_Power-On_bin_start;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:15:27: error: expected initializer before '-' token
 const uint32_t video_Screensaver_bin_length = 1185126;
 ^
 generated/videos/include/videos/VideoDatabase.hpp:17:34: error: expected initializer before '-' token
 extern const uint8_t* video_Screensaver_bin_start;
 ^
 generated/simulator/src/mainBase.cpp: In function 'void setupVideoDecoder(touchgfx::HAL&)':
 generated/simulator/src/mainBase.cpp:42:131: error: 'video_Power_On_bin_length' was not declared in this scope
 setupVideo(static_cast<touchgfx::HALSDL2&>(hal).localFileName(videoFileName, 400, "Power-On.bin"), &video_Power_On_bin_start, video_Power_On_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~
 generated/simulator/src/mainBase.cpp:42:131: note: suggested alternative: 'video_Power_On_bin_start'
 setupVideo(static_cast<touchgfx::HALSDL2&>(hal).localFileName(videoFileName, 400, "Power-On.bin"), &video_Power_On_bin_start, video_Power_On_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~
 video_Power_On_bin_start
 generated/simulator/src/mainBase.cpp:43:149: error: 'video_Screensaver_bin_length' was not declared in this scope
 setupVideo(static_cast<touchgfx::HALSDL2&>(hal).localFileName(videoFileName, 400, "Screensaver.bin"), &video_Screensaver_bin_start, video_Screensaver_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 generated/simulator/src/mainBase.cpp:43:149: note: suggested alternative: 'video_Screensaver_bin_start'
 setupVideo(static_cast<touchgfx::HALSDL2&>(hal).localFileName(videoFileName, 400, "Screensaver.bin"), &video_Screensaver_bin_start, video_Screensaver_bin_length);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 video_Screensaver_bin_start
 make[2]: *** [build/MINGW32_NT-6.2/generated/simulator/src/mainBase.o] Error 1
 generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/generated/simulator/src/mainBase.o' failed
 generated/simulator/gcc/Makefile:155: recipe for target 'generate_assets' failed
 make[1]: *** [generate_assets] Error 2
 simulator/gcc/Makefile:32: recipe for target 'all' failed
 make: *** [all] Error 2
 Failed
 Failed

 

 

 

 

7 replies

sm1981Author
Associate
October 23, 2024

Hmm, I just read this:

Limitations

TouchGFX does not support video decoding in portrait mode.

 

My simulator is currently setup as 600 px wide and 1024 px tall. Could that be issue?

It seems like a rather strong limitation. I was currently possibly using an STM32 chip for our product since we need a pretty extensive GUI and it felt like TouchGFX would allow us to get to market faster. Without video support, all our GUI plans will collapse.

 

Is this limitation something ST is working on currently?

sm1981Author
Associate
November 9, 2024

Bumping this up, with hopefully some insight from a rep.

 

Thanks

Visitor II
November 23, 2024

It sounds like the issue might be with the MJPEG conversion. Try using FFmpeg for reliable results:

 

ffmpeg -i input.mp4 -vcodec mjpeg -q:v 2 -an output.avi

Make sure the video matches TouchGFX requirements (resolution, frame rate, and container format like AVI). If it works on Windows but not in TouchGFX, check the error logs for more details.

If you're editing in CapCut, export in high quality first, then convert with FFmpeg. Let me know if you need help with this! :smiling_face_with_smiling_eyes: also check this 

sm1981Author
Associate
November 25, 2024

Thank you for the reply.

 

I wasn't using FFmpeg so I gave it a shot and it now works in the simulator, so there definitely was a format/codec compatibility issue of some sort.

Thank you.

 

Now the video works fine in either Landscape or Portrait mode in Simulator mode (pure TouchGFX project).

 

However, if I set it up through TouchGFX from a CubeIDE/MX project in which I have configured the hardware, the video will only run in Landscape mode within the simulator or the hardware custom board with display attached to it.

 

So I am back to my original question (thread tittle) and I am wondering if there is a known workaround to this rather annoying limitation?

Is the current limitation affecting both software and hardware decoding? Since it doesn't work in TouchGFX's simulator I am guessing it's not a hardware problem, but I could be wrong?

 

Is this something ST engineers are currently working on?

sm1981Author
Associate
November 28, 2024
Osman SOYKURT
Technical Moderator
February 13, 2025

Hello @sm1981 ,

I have good news for you, we will have official support of video in portrait mode in the next release version of TouchGFX (4.25.0).

Best regards,
Osman

Osman SOYKURTST Software Developer | TouchGFX
sm1981Author
Associate
February 28, 2025

Hi Osman

Do you have any updates? I was told week 9 but it looks like there has been a delay?

Osman SOYKURT
Technical Moderator
October 3, 2025

Hello @gerthmar ,

The rotated video is indeed something we implemented on TouchGFX 4.25.0.
2 things are needed to use it :

  • change the display orientation in touchgfx to portrait

OsmanSOYKURT_2-1759500081907.png

 

  • change the video orientation in STM32CubeMX to rotated 

OsmanSOYKURT_0-1759500043888.png

 

With these 2 changes it should be working.

Osman SOYKURTST Software Developer | TouchGFX
Associate
October 3, 2025

Hi @Osman SOYKURT 

Thank you for your reply. That is what I tried, but unfortunately without success. I only see the upper part of the video (probably around 480 pixels) while my display is 800x480 pixels. I use a stride value of 832, not sure if that makes a difference.

I am using TouchGFX 4.26.0.

 

 

ST Employee
October 7, 2025

Your stride value should not be a problem in this case. I suspect that you are using a video buffer, and that it is set up wrong. I think it should be set to 800x480, and the rendered images are then copied to the framebuffer, where the rotation is applied. If it's already 800x480, I'm probably wrong, and you should try swapping it anyway :)

Visitor II
December 3, 2025

Hi @mathiasmarkussen 

I'm working on this project with @gerthmar.

I made the settings as recomended in the answers to this post. 
Settings_CubeMX.JPGSettings_TouchGFX.JPG

The result on the device looks like that:
Result_on_device.jpg

When i tried to swap the buffer width and height, the result was worse than before and nothing of the video gets shown.
WhatsApp Bild 2025-12-03 um 15.14.13_301e0732.jpg

Thanks. 

Best regards,

Adrian

ST Employee
December 10, 2025

I have asked around a bit, and have identified the reason for this.

The STM32F769 is an edge case when it comes to hardware video decoding. For all MCUs with hardware video decoding except the F7, DMA2D can perform a conversion from YcBcR to RGB. This is done into a smaller intermediate buffer, that is then copied and, if needed, rotated into the video buffer.

The F769 DMA2D does not support YcBcR, so this conversion is done in software instead. This code path does not rotate the video before putting it into the final buffer.

If your hardware design is final, and you cannot select another MCU (which I suspect from your images), another option is to rotate you videos at encode time in FFMPEG. I have attached a project that demonstrates how this can be done, and how to modify the video widget in TouchGFX, so it draws the widget with width and height swapped.

Also note that you video buffers do not need to be larger than the largest video you expect to show, and if you rotate the video at encode time, it should match the actual size of the video, not be aligned with the framebuffers as you have them now.

Read readme.md in the project, it is pretty well described there, and let me know if you have any further questions.