Skip to content

About

A (sorta) GIF player for ESP32/Arduino

Resources

Stars

11 stars

Watchers

1 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

AnimPlayer32

GitHub issues GitHub all releases GitHub License GitHub Release Static Badge

A (sorta) GIF player for ESP32/arduino

Showcase

ezgif-6-591bf0e6e6-ezgif com-optimize

Hardware Dependencies

For this project you dont need really much stuff. Stuff you need:

  • ESP32 (or any arduino compatible board that can handle JPG processing.)
  • Display (any display supported by Bodmer's TFT_eSPI works.)
  • SD card slot (can be internal and external module)
  • Wires (obviously, unless...)

Important

Some other arduino compatible boards dont work with some libraries in this code, thus it will need a port.

Software Dependencies

For the code to upload and work properly you will need some extra libraries:

Note

FS and SPIFFS are included in the ESP32/ESP8266 core, if you dont have one of these boards you might have to install them seperately.

I have developed a software for automatically turning GIFS to frames used by this program. You will need it unless you will do it manually. animplayer32converter

Setup

Before flash

If using PlatformIO, go to platformio.ini and change the TFT_eSPI display settings. At the beginning of the code in the .ino file there is a special section where you can toggle different debug/optimisation settings. As of now they are:

SETTINGS FOR DEBUGGING AND GENERAL OPTIMIZATION
preloadCount = amount of frames to preload
showFPS = show FPS counter at the top left of the screen
showFramePassed =  show what GIF frame its currently on
reset10thFrame = not very good optimisation method but im keeping it here, resets display (white screen) every 10th frame
resetAfterPlayback = SLIGHTLY better perfomance but at the end of the GIF a white screen flashes for a second
useLegacy =  use legacy frame counting mode (defined in code)

useLegacy will have more docummentation here

Important

Wire the display and SD card module correctly, you can change the pins if you want to for the SD. The TFT has your config in the User_Setup.h file of the TFT_eSPI library. Dont forget to set up TFT_eSPI first.

Flashing

After fiddling with the settings, it is time to flash. just use your ideal IDE to flash the code onto your board

Creating a GIF for AnimPlayer32

I have made a program for automatizing that, as mentioned. It is really simple, just follow what it says.

  • Download the program

Download it here.

  • Input the path of your GIF, then press Enter. path input

  • You will have to input the drive letter of the SD card, or any folder if you want to save it to your PC.

drive input

  • Input Y to confirm, N to exit.

image

  • The program automatically converts the GIFs to .jpg format and renames them.

image

  • Results

image

Warning

GIFs have alpha transparency, just like PNGs. So some GIF frames can be corrupted after conversion, if it happens try again with a similar GIF.

Other

useLegacy

useLegacy is only useful for GIFs with many frames, as it will take long (depending on SD card and MCU speed) to count them all to make the program know how much frames to play.

  • Set useLegacy as true in the code

  • Comment the variable with 0 and uncomment the one where it says legacy. put the amount of frames the GIF has there

After that frame counting will be instantaneous (as it doesnt need to go through the files to scan) , its unreliable if you hotswap GIFs through your SD card, and its only reccomended for large GIFs that will take a lot of time to count.

Slight optimizations for large GIFs

You can put these settings as true to get slight perfomance increase.

image

Note

Its only reliable for large GIFs, once again. But resetAfterPlayback can be a bit useful for lighter GIFs.

Perfomance

These are my tests that I have tested on specific hardware. Any little thing can impact perfomance, even the GIF used. If you want, you can post your own perfomance results at the issues section and tag it as "Perfomance test", dont forget to write your board, SD card slot model, TFT driver, SD card itself, SPI speeds used and a video showing the FPS.

  • My tests: ESP32, ST7735 display, random SD card slot, 128mb SD card and 80mhz SPI speed (not sure if some of that has gone to waste)\
    • v1.0.0
      Max: 15-ish FPS
      Min: 13-ish FPS
    • v1.1.0
      Max: 21-ish FPS
      Min: 20-ish FPS
  • Community tests: coming soon, hopefully

About

A (sorta) GIF player for ESP32/Arduino

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages