Mode 7 Encoding
Jump to navigation
Jump to search
Overview
Video mode 7 is dedicated to stream raw video data from an SD card. So you want to put a video onto the uzebox using Mode 7? There are several ways to do it but here's the general outline
- convert your video into an image sequence that is 147 x 114 pixels, one byte per pixel, uses the uzebox palette, and has a rate of about 60 images per second.
- convert your audio into an uncompresed unsigned 8-bit PCM wav file at NTSC line rate (15750Hz).
- multiplex the raw data togeter according to Mode 7 Implementation Details
Uze's Method
- In Adobe Premiere extract frames to numbered BMP files & extract sound track to a WAV file.
- In Photoshop make a batch process to read the BMP files an apply the following transformation:
- resize to 147x114
- Resize the canvas from the left to 170x114. This will produce 23pix wide black bar to the left
- Convert to paletted mode using the Uzebox palette, applying dithering of about %75
- Save picture as RAW file 8bpp, no header
- In CoolEdit pro (sound editing software) convert the soudtrack to 8bit mono 15750Hz, save a raw signed
- Use my java tool (unavailable) to pack and interleave frames with audio.
- Done!
JRoatch's Method
- Extract the video frames into an image sequence using ffmpeg.
- ffmpeg -i ../8bit_trip.mp4 -r 60000/1001 -s 146x80 -f image2 frame%05d.png
- Process images using imagemagick, and turn them into portable pixmap files.
- mogrify -gravity East -background black -extent 170x114 frame*.png
- mogrify -map ../color_table.png -format ppm *.png
- The audio probiably could have been extracted by ffmpeg, but I used Quicktime on a mac to extract the audio to 15700hz. 15700 because I belive that fits better with the Mode 7 Implementation Details.
- multiplex the data using a quick c program I wrote.
- ./mode7multiplexer output.dat audio.wav frame*.ppm
Nebososo's Method
This method is based on JRoatch's, not only it is completely scripted, but it won't generate black bars on the top. I haven't tried, but I believe it can be easily adapted to windows. It also supports any format ffmpeg does.
- Save the color table to any folder you like.
- Compile JRoatch's Multiplexer, rename it to m7m and put it in the same folder.
- Save the script I wrote in the same folder and chmod +x it.
- Run the script as in the example: ./touzm novijgod.avi ngod.uzm
- Copy the uzm file to the beginning of the SD card (before all the uze files), if you put it in the end, the image will be messed up. (I have a script to format the card, copy the wavs first, then the uzms and, finally, the uzes)