This is such a reoccurring question, I've always wanted to make a FAQ about this where we can point to. There are quite a few possibilities and it depends on the system and case which one is the best for you.
Thank you Max for responding here!
A) inside GEM You can record the GEM window inside GEM with pix_record and pix_snap. This is the cleanest and cross platform solution, because it doesn't require additional soft- or hardware. You can also render things slower than realtime, while making sure to save every frame.
I tried this and it works kinda great! I attach a patch for others that does pretty much that.
Here are a few questions to everyone that have just arisen:
I am not selecting a particular codec, perhaps the first codec in the list codec 0 ffmpeg_mpg4 FFMPEG MPEG-4 is used as default?
It is cool that the resulting file (header) seems to know about the Gem framerate, although I am recording with individual bangs rather than the auto message. The codec seems to support 20 and 25 fps, but for example not 22fps as it tells me then that [mpeg4 @ 0x55e50833bac0] removing common factors from framerate [mpeg4 @ 0x55e50833bac0] timebase 22727/500000 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535
I am doing this on Debian(testing) and having started Pd from an xterm I am getting a line of [mpeg4 @ 0x55e50809b620] AVFrame.format is not set [mpeg4 @ 0x55e50809b620] AVFrame.width or height is not set there for every frame that is written to disk.
In addition the helpfile for pix_record mentions a [dialog< message, that has no effect (on my O.S) and is lacking the info that the codec list and properties are given at the third outlet of [pix_record] and that the default for the [auto< message seems to be "1".
Upon closing my patch I get the following red line in the Pd console: record: implementation forgot to call close() - please report a bug!
Creating a pix_snap object (in an empty patch) gives: GEM: Someone sent a bogus pointer to copy2Image
I hope this is not a bad thing! ;)
thank you all again! Peter