Kuinka tehdä toimiva mosaiikki RTSP streameista? FFMPEG

Moi!
Tämä on muodostunut haasteelliseksi. Eli pitäisi saada luotettavasti toimimaan neljän kameran mosaiikki live-kuva. Olen yrittänyt ffmpeg -ohjelmalla näin:

ffmpeg -rtsp_transport tcp \
    -i rtsp://192.168.1.119/av0_1:554 \
    -i rtsp://192.168.1.121/av0_1:554 \
    -i rtsp://192.168.1.122/av0_1:554 \
    -i rtsp://192.168.1.123/av0_1:554 \
    -filter_complex "
		nullsrc=size=1920x1080 [base];
		[0:v] setpts=PTS-STARTPTS, scale=960x540 [upperleft];
		[1:v] setpts=PTS-STARTPTS, scale=960x540 [upperright];
		[2:v] setpts=PTS-STARTPTS, scale=960x540 [lowerleft];
		[3:v] setpts=PTS-STARTPTS, scale=960x540 [lowerright];
		[base][upperleft] overlay=shortest=1 [tmp1];
		[tmp1][upperright] overlay=shortest=1:x=960 [tmp2];
		[tmp2][lowerleft] overlay=shortest=1:y=540 [tmp3];
		[tmp3][lowerright] overlay=shortest=1:x=960:y=540
	" \
	-c:v libx264 -preset superfast -crf 18 -f matroska - | mplayer -fs -

Toimii, mutta muutaman sekunnin jälkeen osa kuvista jäätyilee/pikselöityy ja ffmpegin tulosteesta näkyy jatkuvat määrät virhettä tähän malliin:

[h264 @ 0x55ce870fd620] error while decoding MB 31 32, bytestream -13 
[h264 @ 0x55ce870fd620] concealing 194 DC, 194 AC, 194 MV errors in I frame
frame= 6763 fps= 25 q=20.0 size=  154601kB time=00:04:29.89 bitrate=4692.5kbits/frame= 6776 fps= 25 q=11.0 size=  155443kB time=00:04:30.43 bitrate=4708.6kbits/frame= 6785 fps= 25 q=12.0 size=  155547kB time=00:04:30.82 bitrate=4705.1kbits/frame= 6797 fps= 25 q=11.0 size=  155782kB time=00:04:31.30 bitrate=4703.8kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet24 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 6 packets
frame= 6811 fps= 25 q=11.0 size=  156096kB time=00:04:32.05 bitrate=4700.3kbits/frame= 6826 fps= 25 q=14.0 size=  156445kB time=00:04:32.40 bitrate=4704.7kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet76 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 6 packets
frame= 6841 fps= 25 q=12.0 size=  156824kB time=00:04:33.01 bitrate=4705.6kbits/frame= 6853 fps= 25 q=11.0 size=  157078kB time=00:04:33.57 bitrate=4703.6kbits/frame= 6866 fps= 25 q=11.0 size=  157310kB time=00:04:34.02 bitrate=4702.8kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet15 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 35 packets
frame= 6878 fps= 25 q=11.0 size=  157535kB time=00:04:34.50 bitrate=4701.3kbits/frame= 6891 fps= 25 q=9.0 size=  157757kB time=00:04:35.01 bitrate=4699.2kbits/sframe= 6904 fps= 25 q=11.0 size=  157970kB time=00:04:35.52 bitrate=4696.9kbits/frame= 6916 fps= 25 q=11.0 size=  158205kB time=00:04:36.03 bitrate=4695.0kbits/[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet36 0 
[rtsp @ 0x55ce86c329c0] RTP: missed 31 packets
[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet40 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 6 packets
frame= 6929 fps= 25 q=11.0 size=  158539kB time=00:04:36.52 bitrate=4696.8kbits/[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet41 0 
[rtsp @ 0x55ce86c329c0] RTP: missed 16 packets
[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet
[rtsp @ 0x55ce86c329c0] RTP: missed 4 packets
[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet
[rtsp @ 0x55ce86c329c0] RTP: missed 14 packets
frame= 6941 fps= 25 q=11.0 size=  158770kB time=00:04:37.01 bitrate=4695.2kbits/frame= 6955 fps= 25 q=11.0 size=  159047kB time=00:04:37.62 bitrate=4693.1kbits/frame= 6967 fps= 25 q=10.0 size=  159315kB time=00:04:38.04 bitrate=4694.0kbits/frame= 6981 fps= 25 q=12.0 size=  159646kB time=00:04:38.61 bitrate=4694.0kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet56 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 47 packets
frame= 6993 fps= 25 q=12.0 size=  159874kB time=00:04:39.09 bitrate=4692.6kbits/[h264 @ 0x55ce86cf9aa0] error while decoding MB 0 26, bytestream -7 0 
[h264 @ 0x55ce86cf9aa0] concealing 489 DC, 489 AC, 489 MV errors in I frame
frame= 7006 fps= 25 q=12.0 size=  160093kB time=00:04:39.63 bitrate=4689.9kbits/frame= 7018 fps= 25 q=17.0 size=  161011kB time=00:04:40.11 bitrate=4708.7kbits/frame= 7031 fps= 25 q=14.0 size=  161118kB time=00:04:40.66 bitrate=4702.7kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet26 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 8 packets
frame= 7043 fps= 25 q=13.0 size=  161325kB time=00:04:41.14 bitrate=4700.7kbits/frame= 7056 fps= 25 q=10.0 size=  161583kB time=00:04:41.68 bitrate=4699.1kbits/frame= 7068 fps= 25 q=12.0 size=  161834kB time=00:04:42.10 bitrate=4699.5kbits/frame= 7081 fps= 25 q=12.0 size=  162163kB time=00:04:42.61 bitrate=4700.5kbits/frame= 7093 fps= 25 q=12.0 size=  162434kB time=00:04:43.09 bitrate=4700.4kbits/[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet77 0 
[rtsp @ 0x55ce86c329c0] RTP: missed 2 packets
[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet78 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 30 packets
frame= 7105 fps= 25 q=12.0 size=  162683kB time=00:04:43.57 bitrate=4699.6kbits/[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet81 0 
[rtsp @ 0x55ce86c329c0] RTP: missed 15 packets
[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet
[rtsp @ 0x55ce86c329c0] RTP: missed 8 packets
[rtsp @ 0x55ce86c329c0] max delay reached. need to consume packet
[rtsp @ 0x55ce86c329c0] RTP: missed 14 packets
[h264 @ 0x55ce86cf9aa0] error while decoding MB 8 31, bytestream -290 
[h264 @ 0x55ce86cf9aa0] concealing 261 DC, 261 AC, 261 MV errors in I frame
frame= 7117 fps= 25 q=11.0 size=  162917kB time=00:04:44.05 bitrate=4698.4kbits/frame= 7130 fps= 25 q=11.0 size=  163143kB time=00:04:44.59 bitrate=4696.0kbits/frame= 7143 fps= 25 q=9.0 size=  163362kB time=00:04:45.08 bitrate=4694.3kbits/sframe= 7155 fps= 25 q=9.0 size=  163584kB time=00:04:45.62 bitrate=4691.8kbits/s[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet04 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 6 packets
frame= 7167 fps= 25 q=10.0 size=  163826kB time=00:04:46.21 bitrate=4689.0kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet07 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 1 packets
frame= 7181 fps= 25 q=12.0 size=  164182kB time=00:04:46.60 bitrate=4692.9kbits/frame= 7194 fps= 25 q=11.0 size=  164444kB time=00:04:47.18 bitrate=4690.8kbits/frame= 7206 fps= 25 q=9.0 size=  164735kB time=00:04:47.60 bitrate=4692.3kbits/sframe= 7220 fps= 25 q=12.0 size=  165136kB time=00:04:48.17 bitrate=4694.4kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet36 0 
[rtsp @ 0x55ce86a8d0e0] RTP: missed 27 packets
[h264 @ 0x55ce870fd620] error while decoding MB 22 28, bytestream -23 
[h264 @ 0x55ce870fd620] concealing 379 DC, 379 AC, 379 MV errors in I frame
frame= 7231 fps= 25 q=10.0 size=  165301kB time=00:04:48.62 bitrate=4691.8kbits/frame= 7245 fps= 25 q=11.0 size=  165608kB time=00:04:49.19 bitrate=4691.1kbits/frame= 7257 fps= 25 q=11.0 size=  165830kB time=00:04:49.67 bitrate=4689.6kbits/frame= 7270 fps= 25 q=17.0 size=  166771kB time=00:04:50.22 bitrate=4707.4kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet
[rtsp @ 0x55ce86a8d0e0] RTP: missed 5 packets
frame= 7282 fps= 25 q=14.0 size=  166891kB time=00:04:50.80 bitrate=4701.3kbits/[rtsp @ 0x55ce86a8d0e0] max delay reached. need to consume packet81 0 

Jossain vaiheessa mplayer tai koko höskä kaatuu ja komentoriviterminaalikin jumittuu niin ettei se enää reagoi vaan pitää sulkea ja avata uusi [terminaali].
Alunperin kokeilin ffplay :ta ja cvlc :tä mediasoittimena mutta mplayer osoittautui vähiten huonoksi.
kamerat työntää 10 fps ja (muistaakseni) 704×576 resoluutiota h264 koodattuna.
Käyttöjärjestelmänä Xubuntu bionic. Kone on kälyinen HP yritys PC i5 ja 3,8 Gt muistia… Htop ei näytä että kone hengästyisi työtaakan alle vaan prosessorikuorma ja muistin käyttö on varsin kohtuullista…
En oikein saa kiinni että mistä kiikastaa. Jotenkinhan se liittyy virheisiin RTP: missed xx packets eli hukkuneisiin paketteihin.

Jos joku tietää jonkun toimivan tavan / (linux) ohjelman jolla voin toteuttaa neljän kameran reaaliaikaisen monitoroinnin luotettavasti yhdelle ruudulle niin kiitollinen olen neuvoista. Ääritapauksessa olen valmis jopa nöyrtymään Windowssin käyttäjäksikin tässä tapauksessa.

Tulipa vielä kokeiltua uusimmalla Lubuntulla live-moodissa tikulta ja, kas kummaa, sehän toimii aivan täydellisesti. Nyt asentelen wanhan Xubuntun päälle Lubuntua. Aika näyttää mitä tapahtuu.