MP4 conversion speed improvement opportunity
While working on #311 I realized that if the file I/O was going nowhere (output file set to an invalid path that didn't exist for example), then conversion would happen dramatically faster but still be long enough to be credible that it would happen (2x capture duration for example). Maybe there's something wrong in our use of file i/o that I would like to investigate later.
To reproduce, use the PDU-based pcap I used to test the pcap-fix branch and convert it to mp4.
I canceled the job on master (before #311) because I wanted to work on something else.
$ time pyrdp-convert.py -f mp4 wrong-output-names.pcap
19% (413 of 2149) |############################# | Elapsed Time: 1:12:52 ETA: 1:08:17^
[... traceback removed ...]
real 73m22.705s
user 74m33.152s
sys 5m2.900s
Pretty crazy for a 160 seconds pcap...
Did some profiling with snakeviz today. It was clear where the bulk of our time was spent:

Reading about ImageQt.fromqimage() I found out that it would compress to png the whole frame. That operation is completely unnecessary here since PyAV will perform compression to video as well. I found a way to pass an array of bytes instead using numpy. Here are the benchmarks.
with from_image via QTImage:
$ time pyrdp-convert.py pyrdp_output/replays/rdp_replay_20210826_12-15-33_512_Stephen215343.pyrdp -f mp4
[*] Converting 'pyrdp_output/replays/rdp_replay_20210826_12-15-33_512_Stephen215343.pyrdp' to MP4
100% (1465 of 1465) |##################################################################################| Elapsed Time: 0:07:08 Time: 0:07:08
[+] Succesfully wrote 'rdp_replay_20210826_12-15-33_512_Stephen215343.mp4'
real 7m23.110s
user 7m33.381s
sys 0m8.217s
with from_ndarray and qimage2ndarray:
$ time pyrdp-convert.py pyrdp_output/replays/rdp_replay_20210826_12-15-33_512_Stephen215343.pyrdp -f mp4
[*] Converting 'pyrdp_output/replays/rdp_replay_20210826_12-15-33_512_Stephen215343.pyrdp' to MP4
100% (1465 of 1465) |##################################################################################| Elapsed Time: 0:00:55 Time: 0:00:55
[+] Succesfully wrote 'rdp_replay_20210826_12-15-33_512_Stephen215343.mp4'
real 0m59.565s
user 1m20.037s
sys 0m1.196s
The previous comment had nothing to do with the investigation needed for this issue. I opened a PR with the same content #349 and I will leave this issue open.