Video file encoder
It defaults to ffmpeg; this will trigger the usual lookup procedures of the system the application runs on. On POSIX this usually means searching for FFmpeg in the directories specified by the environment variable PATH. On Windows it will also look for an executable file with that name in the current working directory.
Run ffmpeg -formats to get a list of available formats.
In the most simplistic case, set up a PixmapRecorder before running the presenter. Then call pixmapRecorder.record(presenter.framebuffer)
at the end of the drawing callback in the eventloop.
auto recorder = new PixmapRecorder(60, /* … */); scope(exit) { const recorderStatus = recorder.stopRecording(); } return presenter.eventLoop(delegate() { // […] recorder.record(presenter.framebuffer); return LoopCtrl.redrawIn(16); });
respectively.
import arsd.pixmaprecorder; import arsd.pixmappaint; /++ This demo renders a 1280×720 video at 30 FPS fading from white (#FFF) to blue (#00F). +/ int main() { // Instantiate a recorder. auto recorder = new PixmapRecorder( 30, // Video framerate [=FPS] "out.mkv", // Output path to write the video file to. ); // We will use this framebuffer later on to provide image data // to the encoder. auto frame = Pixmap(1280, 720); for (int light = 0xFF; light >= 0; --light) { auto color = Color(light, light, 0xFF); frame.clear(color); // Record the current frame. // The video resolution to use is derived from the first frame. recorder.put(frame); } // End and finalize the recording process. return recorder.stopRecording(); }
Pixmap Recorder is an auxiliary library for rendering video files from Pixmap frames by piping them to FFmpeg.