Creating a video from data of server-side script
<p>My plan is to display the data that a server-side script generates in a video displayable on my web page. So far my approach is the following:</p>

<ol>
<li>A three dimensional integer array in a C script is use to accumulate the image data. Dimensions are width, breadth and color (R, G and B).</li>
<li>The array is written to a ppm-file. </li>
<li>The next picture is accumulated and written and so on.</li>
<li>With ffmpeg a script merges the ppm-files to a mp4-video.</li>
</ol>

<p>Basically this works, but of course faster would be nicer. I would appreciate proposals for fundamentally different approaches as well as help on the following details:</p>

<ul>
<li>Is there a file format simple as ppm that uses the HEX code for colors instead of triplets? This would reduce the size of my array as well a the number of write operations.</li>
<li>Do I loose much time if I print every single value to the file with an fprintf operation instead of accumulating lines into a string? Or do compilers optimize this kind of sequences of writes?</li>
</ul>