August 28, 2014 at 5:50 am #1337
Today I tweeted that I converted one of my favorite films, The Incredibles, to Game Frame. The whole movie fits into 114MB — uncompressed! 🙂 Several people responded, asking for a sample and explanation of how it’s done.
Here’s a clip of what it looks like:
Converting movies is pretty easy with this script I wrote (at least for Windows users). As that page says, you’ll need ImageMagick installed, and then you just drag your video onto the script. After several minutes, you’ll have a folder you can copy to Game Frame.
A few caveats:
- The programs called by the script don’t seem to like converting HD to 16×16, so you’ll need standard definition sources (DVD rips) or smaller.
- You probably don’t want to squeeze a widescreen movie into a square. I re-rendered the movie from Vegas Video, center cropped into a square. I actually rendered to a 16×16 uncompressed AVI, which sped up the process and allowed Vegas to control the video scaling.
- It helps to know a little about video editing. In general, you want to render at the same frame rate as the source video and turn off any kind of resampling/frame blending. In the case of Vegas, experiment with different “full resolution rendering quality modes” in project settings — this affects anti-aliasing at 16×16. I like the “Good” setting.
That’s it though. Once I rendered the square video, I just dragged it on the script and off it went. As for the good Mac and Linux people in the crowd, I hope someone with expertise on those platforms can port the script. In the meantime, you can probably figure out the key commands by reading the script and Googling and little for the proper syntax.September 1, 2014 at 8:15 pm #1364glennParticipant
Do you not have issues with framerate with large videos like this?
When I tried playing video-framerate data, I found that it couldn’t manage the framerate. It’d start around 15-20 FPS (didn’t measure it), which was too low to keep up with movies, then progressively slow down as it rendered frames. It got down to around 4-5 FPS before I stopped it (don’t recall how long the video was, probably a few hundred frames). It looked like two problems: the frame rendering speed (too much conversion, etc. happening), and I think the SDFAT code is re-scanning the directory to find each file, so as it went further into the directory it’d take longer and longer to find the next frame.
I ended up editing the firmware to make a movie player. It uses a custom pre-swizzled file format, which lets me read each frame directly into the backing store (reducing read-and-flip to a few lines of code), and which puts the whole video in a single file, so it never has to switch files mid-video. It manages around 50 FPS. 60 would be nice, but I was only looking to break 24, so I can export full-framerate animations from AFX. (I haven’t done anything with it or cleaned it up, or I’d send a PR as an alternate firmware.)September 1, 2014 at 10:24 pm #1365
That’s really interesting, Glenn. To your original question, I don’t have a problem with The Incredibles render I did, which is around 150,000 frames. I did the Lego Movie too, which runs just as smooth. According to my debug output, they run at approximately 24fps. As I’m sure you know, my script above outputs filmstrip BMPs that are 2000 frames long, so I’m confused why your “few hundred frames” movie created multiple files. The very reason for the filmstrips is to keep the system from having to open new files for each frame. The whole Incredibles movie is only 78 BMP files, and switching files doesn’t appear to cause slowdown.
I would be curious if you experienced the same problem with a freshly formatted microSD card.
Nonetheless, your solution sounds like it creates much higher frame rate playback. I’m very curious what your file format looks like, and why it’s so much faster. BMPs practically mirror the frame buffer byte-for-byte.September 1, 2014 at 10:55 pm #1366glennParticipant
I don’t know what a “filmstrip BMP” is. Googling for it brings me back here, it looks like you mean a sprite sheet. I didn’t think of trying that–all of the examples on the SD card were one file per frame.
The main difference is that I used the exact format of the backing store, with the pixel order and zigzag pixel output order baked into the file. This means the loop of reading a row at a time goes away, since I can just do read(strip.getPixels(), 768); strip.show(). The frame delay is embedded per-frame (though I doubt I’ll use anything but a constant value). I have a simple Python script to convert from an image sequence to this format.
Sprite sheets would probably have done the job, but I like the result (INI files go away, and each video is a single file in the top directory), and it only took a few hours to do. (I spent more time getting Arduino to work than actually implementing anything, actually…)September 1, 2014 at 11:03 pm #1367
Oh, very cool! I can see how embedding the zigzag into the file structure would greatly improve frame rate. Clever!
Anyway, yes — the filmstrips are basically vertical sprite sheets of 16×16 spites. They’re not as efficient as your method, but they get you to 24/25 fps.January 19, 2015 at 5:00 pm #1784
Do you have a program for other sizes?????January 19, 2015 at 5:34 pm #1785
What do you mean, other sizes?January 19, 2015 at 6:01 pm #1786
Like a 32×32 or a 64×64. Thank you for your fast respond, but i will try to write my program. If i can’t do it successfully would you help me.January 19, 2015 at 8:14 pm #1787
I’m still not clear what you want or how it relates to this thread. Can you explain with more detail? Do you mean a higher resolution Game Frame?January 19, 2015 at 8:46 pm #1788
Yes, for my final paper on school I want to make a advertisement led panel with a resolution of 64×64 that shows videos animation en so on. You are the first one that made a program that compiled a video into a large bitmap.
I just made a program in processing that does the same but places all the rgb values in a txt file. If you want I can post it here.January 19, 2015 at 11:30 pm #1789
This is outside the scope of this thread but you can certainly make larger grids. Alternatively I would look at the 32×32 and 64×32 panels here:
Adafruit also links to a couple libraries that will allow you to play animations. The brightness is no where near Game Frame/NeoPixels/ws2812b but it will be the cheaper and faster route for a school project.
- You must be logged in to reply to this topic.