Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to play a video on an SSD1306 OLED

By Nikhil Agnihotri January 18, 2023

Small organic light-emitting diode (OLED) displays are commonly used in embedded devices. This is because OLEDs generally cost the same as character LCDs but feature a better user interface (UI) and user experience (UX). 

Typically, embedded OLED screens are used to display textual messages, but what about videos? For example, is it possible to playback a video on a small 0.96″ OLED? 

This is no problem for an OLED, which offers little limitations on its display. The challenge herein lies with the microcontroller. Microcontrollers are designed for simple tasks that does not include video processing. So, displaying a small video clip on an 0.96″ OLED requires a trick of the trade. 

To be clear, microcontrollers cannot be programmed to process video formats. However, it is possible to extract sufficient frames from a video clip and convert those frames into executable code. When the frames are displayed in a sequence, it will appear as though the same video clip is running via the microcontroller. 

For this project, we’ll prepare and play a video clip on a monochrome SSD1306 OLED. 

Choose your microcontroller
It’s important to note that not all microcontrollers will be up to the task of displaying selective frames from a video clip — even if these frames are only a second or two in length. 

For instance, the maximum flash memory on Arduino boards is typically 256 Kb. This is insufficient to store the code of five or more video frames that are 128×64 in dimension. So, for this project, we’ll need a microcontroller with a large flash memory. 

ESP32 is one option that’s suitable for video playback since its memory ranges from 4 to 16 MB, which is enough to store the code of multiple frames. To ensure reliability, we’ll trim down a video clip that’s 12 seconds long into 36 frames so ESP32 can play back the frames with ease. 

Interfacing SSD1306 OLED with ESP32
First, it’s necessary to interface the OLED with our microcontroller. Here, we’re using a monochrome 0.96″ SSD1306 OLED and ESP32. A 7-pin OLED module connects with ESP32 through an SPI interface. 

The SSD1306 OLED and ESP32 have the following circuit connections…

 

The SSD1306 OLED, interfaced with ESP32, has this circuit diagram:

The video clip
You can take any video clip that’s a few seconds in length. In this project, we’ve selected one that’s about 12 seconds in length. This clip has a resolution of 1920×1080 and a frame rate of 30 fps.

Preparing the video
The video clip is an RGB video, but we’ll be playing it on a monochrome OLED, which means it must be grayscale. It’s easy to convert the clip to grayscale video by using an online video editor. We used MovieMakerOnline.

If you use the same tool, simply navigate to moviemakeronline.com and the upload target video file by clicking the “Add File” icon.

After the file is uploaded, click on the “Effects” button.

Next, click the “Add Effect” button.

Choose the “Thresholder” option from the effects.

Click on the “Make Video” button and wait for the video to finish processing.

After the video is processed, click on the “Watch the Movie” icon.

When the grayscale-d video plays, right-click and select the “Save Video As…”

Be sure to save the grayscale video under a different name.

The new grayscale video will still display a resolution of 1920×1080 and a frame rate of 30 fps.

The grayscale video looks like this…

Trimming the video to size
Our OLED display has a resolution of 128×64, which does not match the video’s frame size. So, we must trim the resolution of the grayscale video to ensure the frames fit within the OLED display for proper viewing. It’s also necessary to reduce the frame rate.

To do, use a professional video editor. We use the VLC media player, which is a free and open-source cross-platform multimedia player. It can be downloaded for Microsoft Windows, macOS, and Linux.

Open the VLC media player and navigate to Media-> Convert/Save.

In the popup window, click on “Add.”

Next, select the target grayscale video and click on the “Convert/Save” button.

In the next window, click on the “Create a New Profile” button.

Next, select the “AVI” tab under “Encapsulation.”

Now, change the Codec to “MPEG-4″and set the frame rate to 5 fps under the “Encoding Parameters” tab of the “Video Codec.”

Ensure the scale is set to “2” as the SSD1306 has a resolution ratio of 2:1 (128:64). Also, set the frame size width to 128 and the height to 64 under the “Resolution” tab of the “Video Codec.”

Next, set the profile name to SSD1306.

Click the “Create” button and you’ll return to the convert window. In the convert window, select the “SSD1306” profile and browse for a spot to save the converted video.

Click on the “Start” to finish the conversion.

Now, we have a grayscale video with a resolution 128×64 and the frame rate is reduced to 5 fps.

[Link to Sample-Video-BWC]

Extracting the frames
Next, we must extract the frames from the 5-fps grayscale video. You’ll want to use a professional video editor for this, such as the VLC media player.

Run the VLC media player as the administrator.

Click on ‘the “All” radio button under the “Show Settings.”

Navigate to Video->Filters.

Select the “Scene Filter” and set the  image format to “jpg,” the filename prefix to “Frame,” and the recording ratio to “5.” Select a destination path to save the extracted frames by browsing the “Directory Path Prefix.” Then, click on “Save.”

Once again, open “Preferences” and choose the “Scene Video Filter” option by navigating to Video->Filters. Be sure to click “Save.”

Close the VLC media player and re-run the administrator. Open and play the 5-fps grayscale video. The video frames will be extracted in the folder set under the “Directory Path Prefix.”

Converting the frames
Select the grayscale frames from the original video with a resolution 128×64 (the resolution of our OLED). Next, it’s necessary to convert the frames into a binary format. To do so, we must first convert the frames into C arrays using any online/offline image converter.

We use LGVL, which is available here.

What’s ideal is it’s possible to upload all the frames simultaneously to this online converter.

Upload the frames and select the color format to “CF_INDEXED_1_BIT.” Then, click on the “Convert” button.

In return, we’ll receive the .c files containing a C array for each frame. We’ll only copy the 64 x 16 hexadecimal array from each file.

The libraries
To install the necessary libraries, open Arduino IDE and install Adafruit_GFX.h and Adafruit_SSD1306.h by navigating to Tools->Manage Libraries. We use ESP32-Dev-kit-V1 for this project, so “DOIT ESP32 DEVKIT V1” is selected by navigating to Tools->Board->ESP32.

The port is selected by navigating to Tools->Port.

The code
The sketch begins by importing SPI.h, Wire.h, Adafruit_GFX.h and Adafruit_SSD1306.h. These libraries are required for the SSD1306 OLED. The variables are defined to store the width and height of the OLED. The variables are also defined for the circuit connections of the OLED for use with ESP32.

An object “display” of the Adafruit_SSD1306 class is instantiated. The C arrays for each frame are stored in the PROGMEM as follows…

The C arrays for all the frames are enumerated in another array: epd_bitmap_allArray[].

In the setup function, the SSD1306 OLED is initiated by calling the display.begin(SSD1306_SWITCHCAPVCC) method.

In the loop() function, a “for loop” is run to clear the display, showing the bitmap array for each frame and providing a delay of 200 ms. All the video frames are played back as the “for loop” completes navigating through the epd_bitmap_allArray[] array. Finally, a delay of one second is aded to provide a pause to the playback.

Results

 

You may also like:


  • How to manage data on ESP32 for IoT projects

  • Getting started with ESP8266 and ESP32 on Arduino IDE

  • MicroPython – Digital input/output in ESP8266 and ESP32

  • How to program an OLED display with Arduino
  • Interfacing SSD1306 OLED
    How to interface SSD1306 OLED with Arduino using SPI

Filed Under: 8051 Microcontroller, Arduino Projects, Electronic Projects, Sensors, Tutorials
Tagged With: display, ESP32, frames, oled, organiclightemittingdiode, spiinterface, video, videostreaming
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Layout IRN reduction in Comparator
  • High Side current sensing
  • What Are the Main Types of Current Sensors?
  • problem connecting to my xilinx device VIA global IP
  • Vivado in combination with vitis question

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe