This tutorial is written for ArchLinux, but also useful for other operating systems.
0. To record Warzone2100's sound and listen to it at the same time, reconfigure Alsa.
Follow the tutorial at https://trac.ffmpeg.org/wiki/Capture/ALSA#Recordaudiofromanapplicationwhilealsoroutingtheaudiotoanoutputdevice and replace '<Your Output Device Name>' with the simple name of your card, e.g. 'Intel' or its number (typically '0') for ~/.asoundrc as suggested there. If unsure, check the output of `arecord -L`.
1. OpenAL does not default to Alsa. To change that, run `mkdir /etc/openal; echo drivers=alsa > alsoft.conf`.
2. When recording, mind the tradeoff between encoding quality and speed. Either framerate or bitrate should be given.
I chose 40fps with lossless encoding and a free container format:
`ffmpeg -video_size 1280x800 -framerate 40 -f x11grab -i $DISPLAY -f alsa -ac 2 -ar 44100 -i loopout -c:a flac -c:v libx264 -qp 0 -preset ultrafast game.mkv`
3. The process may be killed with 'SIGINT' or 'SIGTERM', e.g. when runinng `ffmpeg [...] & sleep 30; warzone2100 --debug=all`.
4. You can also limit the size of your output file, e.g. with `-fs 500M game.mkv`.
5. Trim and split the video as needed. To remove the first 30s and last 15s in a video of 25 minutes, run:
`ffmpeg -i game.mkv -ss 30 -to 24:45 -vcodec libx264 -qp 0 -acodec flac ingame.mkv`
Reencode! Do not copy input streams with `-c copy` or the equivalent `-acodec copy -vcodec copy` since this corrupts the output file.
6. Codec compression is useful for lossless codecs. I saved ~30% filesize with:
`ffmpeg -i game.mkv -vcodec libx264 -qp 0 -preset veryslow -acodec flac -compression_level 12 game_upload.mkv`
7. Consider process imaging to safeguard against power outage if FFmpeg takes a long time, e.g. with dmtcp or cryopid.
8. Check your files, e.g. with `ffprobe -hide_banner game.mkv`.
9. Extract frames and store them as images.
Take a screenshot in the middle of the 30th second 800px large:
`ffmpeg -i game.mkv -ss 30.5 -vframes 1 -vf scale=800:800 screenshot.png`
Create a list of thumbnails to chose from, e.g. for YouTube:
`ffmpeg -i game.mkv -vf 'select=gt(scene\,0.5)' -vsync vfr -vframes 3 thumbnail_%03d.png`
10. For further help read man pages, visit https://trac.ffmpeg.org or join Freenode's #ffmpeg channel.