Using Processing to filter (simplify) a video file.
Hi all. I'm trying to make a LED matrix display using the Arduino, which ideally reads the display data off an SD card. I've looked into a bunch of different file formats, and the closest thing to what I need appears to be Quicktime uncompressed 32-bit argb. It's raw RGB frame data, is readily supported by the authoring software I'm using, and allows me to output in the resolution of my display.
I looked into reading the .mov file directly, but it is a twisted mess of headers, structures, and metadata that is pretty useless to me. Processing has no problem opening and playing the video files I have. What I'm hoping to do next is extract the raw frame data and write it to a binary file to include on the SD card, but I can't seem to figure out what function would allow me to do that. Any of the 'save*' functions appear to open the file, write what you provide, and close again, leaving me with only one frame.
How can I use processing to take the stream of frames and write the raw RGB data to a file?
Posted Dec 17, 2014, 11:15 PM UTC
Maybe try the movieEvent() callback?Edit: Maybe not. Sorry been a while since I've touched Processing... Do you ever use Cinder or OF? Would be pretty easy do do it with one of those. Then you could format the output file however you wanted.OK I was bored. Here's how to get individual pixel values from a frame of a video. idk how to do file I/O in processing but that shouldn't be too hard. If you can't figure it out. I'll check it out:
Edit: THIS DOESN'T EVEN COMPILE MY BAD SORRY OOPS see below for (probably) working code
It's not in the documentation, but I found in a code example that: frame.width and frame.height return the dimensions of the frame.
Do the variables r,g, and b have to be float? They're byte internally.
Ok scratch all that above. There's a ton wrong. Try this: https://www.processing.org/reference/colorMode_.html
IT at least runs but I don't have any way to test the values;
This looks promising! I'll give it a go and report back in a few... Thanks!
[Edit] no go. For whatever reason the applet crashes hard. I tried upgrading from 1.5.1 to the newest 2.x, but 2.x doesn't even open my source movie file in the sketches I had working. If I find a way to either keep a file open or append to a file I've written, I'll surely integrate the bits of code that comb over the movie and extract the values of interest. Thanks for all the help.