Why? Because I wanted to and because Rust rocks!
A full demo can be found here.
This project was built using an STM32F303ZE
with a simple ssd1306
OLED display.
On my chip it can draw 21x10 characters (83x60 pixels) with stable 8 frames per second and
was designed and built to play Bad Apple, but anything else would also work.
Frame timings and length of the video can be adjusted, too high frames per second can lead to slowed down playback due to the render time being larger than the desired one.
Faster render times (lower fps) are being adjusted for.
- Convert a video to an ASCII file, using
video-to-asciiy
- Adjust frame timing in the main program (draw time per picture, width, height, total frames)
- Flash and enjoy!
Don’t forget to adjust the HAL and I2C pins in the code.
The lastest ascii.txt
I used is also present in this repository.
The screen renders video through ASCII characters. It takes in a long text file, containing all the images in a contiguous stream, which is then read in IMAGE_LEN
-sized (height * width + newline chars) chunks in the main program.
If these parameters don’t match up, the end result won’t either.
video-to-ascii
needs ffmpeg-libraries, which (on rpm-based distros) can be installed via dnf install ffmpeg-devel
.
- [X] Fix timing in draw (still a tiny bit off, but it’s fine)
- [X] Rewrite ASCII conversion in Rust or Haskell (with an own implementation of
ascii-to-text
) - [ ] Optimize
video-to-ascii
conversion speed