Implement recording to Matroska files. The format to use is determined by the option -F/--record-format if set, or by the file extension (".mp4" or ".mkv").
When recording, the header must be written with extradata set to the content of the very first packet. Suggested-by: Steve Lhomme <robux4@ycbcr.xyz> Fixes <https://github.com/Genymobile/scrcpy/issues/351> Fixes <https://github.com/Genymobile/scrcpy/issues/416>
Implement recording in a separate "class".