Simple video file format?

Started by
6 comments, last by Antheus 16 years, 6 months ago
Hello, I'm working on a little raytracer which I'd like to use to produce some short animations (render the scene, save it out as a frame of video, move some stuff, render the scene again, save it out etc etc). I'm trying to work out what file format would be the simplest thing to save the video out as. - I don't need to save out any audio - I would like the format to be something as universal and cross-platform as possible, the kind of thing that you can display on Windows, Linux and Mac boxes - I don't mind too much about the resulting file size - by which I mean I'd rather have simple code and a big resulting video file than complex code (or reliance on external libraries) and a smaller video file. - I could probably cope with having some kind of colour palette rather than full 24-bit RGB values, if that was necessary. - I'm writing in C/C++, if it makes any difference Any suggestions? I figured maybe GIF or some kind of AVI codec perhaps, but I don't know how cross-platform they are, or how easy it is to create those kind of files. Ideally I'd just like something where I can just write a file header saying "This is a video file of type FOO. It's size is X * Y pixels, and it's Z frames long", followed by just a series of images. Are there still such naive formats in reasonably common usage anywhere?
"We two, the World and I, are stubborn fellows at loggerheads, and naturally whichever has the thinner skull will get it broken" - Richard Wagner
Advertisement
A simple solution would be to shift the problem onto another piece of software - save out the frames as PNG/JPEG/Bitmaps, and then use some free video software like virtualdub to encode those frames into MPEG2/MPEG4/Quicktime/DivX
Oops. Triple post, sorry.
Sorry for triple post, again.
You can try searching for '(ext) file format' where (ext) can be whatever file format you want to use. For example, http://www.google.com/search?q=GIF+file+format. You should find a webpage that explains what, exactly, all the random letters mean when you open such a file in a text editor. Or you could find a free DLL or library to do this for you automatically (from JPG, BMP, GIF, etc. frames).
Hi, thanks for the replies.

I'm aware that the simplest option from a coding standpoint would be to save out a series of images and let another program do the conversion, and that trying to write my own video exporter as part of the program is kinda reinventing the wheel, but for various strange and complex reasons, I'd like my program to be a standalone thing with no reliance on other programs or libraries.

From hunting around a bit, it looks like GIF might be a workable solution, although that's based only on the fact that I managed to find a reasonably clear specification for it, and it's a file format I've heard of. If there's anything which is as simple (or simpler!) to write an exporter for and doesn't require indexed colour, I'd be interested in hearing about it.
"We two, the World and I, are stubborn fellows at loggerheads, and naturally whichever has the thinner skull will get it broken" - Richard Wagner
Save frames in PNG or JPEG, and then use the free, open, available-as-a-debian-package FFMPEG library or command-line application to convert to whatever video format you want.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
There is RAW format (AVI codec, different ones exist for DV and Qt), it should be natively supported by windows AVI players.

But for the life of me I cannot find the specification.

It basically involves using AVI file structure (just basic RIFF/IFF), and then dumping RGB frames. Perhaps someone else will find how the header needs to be set and the data ordered.

virtualdub source might also give some insight.

If you use this, you should be able to get playable video stream, and use any DirectMedia-compatible video editing software to compress it.

This topic is closed to new replies.

Advertisement