radek-k / FFMediaToolkit

FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
MIT License
352 stars 56 forks source link

Video.AddFrame(FrameToImageData(ImageData)) causes program to exit with code 139 #81

Closed yagarea closed 3 years ago

yagarea commented 3 years ago

In my C# program I have instance of MediaOutput from FFMediaToolkit. It is initialized like this:

MediaOutput buffer = MediaBuilder.CreateContainer(videoPath).WithVideo(new VideoEncoderSettings(width: width,
                height: height, framerate: frameRate,
                codec: VideoCodec.H264)
            ).Create();

When I want to add frame to buffer I use this code:

private static ImageData FrameToImageData(Bitmap bitmap) {
    Rectangle rect = new Rectangle(System.Drawing.Point.Empty, bitmap.Size);
    BitmapData bitLock = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
    ImageData bitmapImageData = ImageData.FromPointer(bitLock.Scan0, ImagePixelFormat.Bgr24, bitmap.Size);
    bitmap.UnlockBits(bitLock);
    return bitmapImageData;
}

public void AddFrame(Bitmap frame) {
    buffer.Video.AddFrame(FrameToImageData(frame));
}

But when code reaches buffer.Video.AddFrame(); it exits with code 139 without throwing any exception.

I have two test files and only one is causing it. One is .png file 100x100 and it works fine. The other is .png file 1000x1000 and it makes program exit as soon as it reaches this method.

What exit code 139 means in C# ?
How can I diagnose this problem when it is not throwing any exceptions ?
How can I fix it ?

Thank you for help. If you need any more information, leave a comment and I will add it soon as possible.

PS: I use arch linux.

yagarea commented 3 years ago

There is pot which could lead to solution: https://stackoverflow.com/questions/46508055/using-ffmpeg-to-cut-audio-from-to-position

It could be caused by argument order.

yagarea commented 3 years ago

This is dmesg ouput:

[17091.524781] Slimulator[20962]: segfault at 7fd84003a011 ip 00007fd8400cd348 sp 00007ffddd9d7fb8 error 4 in libswscale.so.5.9.100[7fd840062000+75000]
[17091.524791] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17091.524829] audit: type=1701 audit(1621440058.690:188): auid=1000 uid=1000 gid=1000 ses=1 pid=20962 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17091.546116] audit: type=1334 audit(1621440058.713:189): prog-id=61 op=LOAD
[17091.546209] audit: type=1334 audit(1621440058.713:190): prog-id=62 op=LOAD
[17091.546262] audit: type=1334 audit(1621440058.713:191): prog-id=63 op=LOAD
[17091.547395] audit: type=1130 audit(1621440058.713:192): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@6-20996-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17094.458151] audit: type=1131 audit(1621440061.623:193): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@6-20996-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17094.542823] audit: type=1334 audit(1621440061.710:194): prog-id=63 op=UNLOAD
[17094.542832] audit: type=1334 audit(1621440061.710:195): prog-id=62 op=UNLOAD
[17094.542836] audit: type=1334 audit(1621440061.710:196): prog-id=61 op=UNLOAD
[17295.099124] Slimulator[21147]: segfault at 7f555b1de011 ip 00007f555b271348 sp 00007fff48239f48 error 4 in libswscale.so.5.9.100[7f555b206000+75000]
[17295.099132] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17295.099197] audit: type=1701 audit(1621440262.267:197): auid=1000 uid=1000 gid=1000 ses=1 pid=21147 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17295.108536] audit: type=1334 audit(1621440262.277:198): prog-id=64 op=LOAD
[17295.108679] audit: type=1334 audit(1621440262.277:199): prog-id=65 op=LOAD
[17295.108752] audit: type=1334 audit(1621440262.277:200): prog-id=66 op=LOAD
[17295.109589] audit: type=1130 audit(1621440262.277:201): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@7-21181-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17297.322989] audit: type=1131 audit(1621440264.487:202): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@7-21181-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17297.401409] audit: type=1334 audit(1621440264.571:203): prog-id=66 op=UNLOAD
[17297.401421] audit: type=1334 audit(1621440264.571:204): prog-id=65 op=UNLOAD
[17297.401426] audit: type=1334 audit(1621440264.571:205): prog-id=64 op=UNLOAD
[17353.331142] Slimulator[21281]: segfault at 7f35f1fd3011 ip 00007f35f2066348 sp 00007ffe7d1288e8 error 4 in libswscale.so.5.9.100[7f35f1ffb000+75000]
[17353.331160] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17353.331214] audit: type=1701 audit(1621440320.498:206): auid=1000 uid=1000 gid=1000 ses=1 pid=21281 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17353.344382] audit: type=1334 audit(1621440320.511:207): prog-id=67 op=LOAD
[17353.344518] audit: type=1334 audit(1621440320.511:208): prog-id=68 op=LOAD
[17353.344566] audit: type=1334 audit(1621440320.511:209): prog-id=69 op=LOAD
[17353.345651] audit: type=1130 audit(1621440320.511:210): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@8-21378-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17356.180885] audit: type=1131 audit(1621440323.345:211): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@8-21378-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17356.261051] audit: type=1334 audit(1621440323.428:212): prog-id=69 op=UNLOAD
[17356.261055] audit: type=1334 audit(1621440323.428:213): prog-id=68 op=UNLOAD
[17356.261057] audit: type=1334 audit(1621440323.428:214): prog-id=67 op=UNLOAD
[17379.499165] Slimulator[21454]: segfault at 7f68418a1011 ip 00007f6841934348 sp 00007ffea9f22eb8 error 4 in libswscale.so.5.9.100[7f68418c9000+75000]
[17379.499174] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17379.499245] audit: type=1701 audit(1621440346.665:215): auid=1000 uid=1000 gid=1000 ses=1 pid=21454 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17379.509368] audit: type=1334 audit(1621440346.675:216): prog-id=70 op=LOAD
[17379.509448] audit: type=1334 audit(1621440346.675:217): prog-id=71 op=LOAD
[17379.509481] audit: type=1334 audit(1621440346.675:218): prog-id=72 op=LOAD
[17379.510098] audit: type=1130 audit(1621440346.675:219): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@9-21492-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17381.661151] audit: type=1131 audit(1621440348.828:220): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@9-21492-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17381.740919] audit: type=1334 audit(1621440348.908:221): prog-id=72 op=UNLOAD
[17381.740924] audit: type=1334 audit(1621440348.908:222): prog-id=71 op=UNLOAD
[17381.740926] audit: type=1334 audit(1621440348.908:223): prog-id=70 op=UNLOAD
[17389.743524] Slimulator[21565]: segfault at 7f95075a4011 ip 00007f9507637348 sp 00007ffccfab3f18 error 4 in libswscale.so.5.9.100[7f95075cc000+75000]
[17389.743535] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17389.743613] audit: type=1701 audit(1621440356.908:224): auid=1000 uid=1000 gid=1000 ses=1 pid=21565 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17389.753604] audit: type=1334 audit(1621440356.918:225): prog-id=73 op=LOAD
[17389.753783] audit: type=1334 audit(1621440356.918:226): prog-id=74 op=LOAD
[17389.753847] audit: type=1334 audit(1621440356.918:227): prog-id=75 op=LOAD
[17389.755847] audit: type=1130 audit(1621440356.921:228): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@10-21600-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17392.121917] audit: type=1131 audit(1621440359.288:229): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@10-21600-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17392.204160] audit: type=1334 audit(1621440359.371:230): prog-id=75 op=UNLOAD
[17392.204167] audit: type=1334 audit(1621440359.371:231): prog-id=74 op=UNLOAD
[17392.204169] audit: type=1334 audit(1621440359.371:232): prog-id=73 op=UNLOAD
[17409.596374] Slimulator[21674]: segfault at 7fddab4c5011 ip 00007fddab558348 sp 00007ffe55e75e28 error 4 in libswscale.so.5.9.100[7fddab4ed000+75000]
[17409.596383] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17409.596441] audit: type=1701 audit(1621440376.762:233): auid=1000 uid=1000 gid=1000 ses=1 pid=21674 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17409.606014] audit: type=1334 audit(1621440376.772:234): prog-id=76 op=LOAD
[17409.606096] audit: type=1334 audit(1621440376.772:235): prog-id=77 op=LOAD
[17409.606139] audit: type=1334 audit(1621440376.772:236): prog-id=78 op=LOAD
[17409.606845] audit: type=1130 audit(1621440376.772:237): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@11-21706-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17411.977651] audit: type=1131 audit(1621440379.145:238): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@11-21706-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17412.074091] audit: type=1334 audit(1621440379.242:239): prog-id=78 op=UNLOAD
[17412.074098] audit: type=1334 audit(1621440379.242:240): prog-id=77 op=UNLOAD
[17412.074101] audit: type=1334 audit(1621440379.242:241): prog-id=76 op=UNLOAD
[17431.213606] Slimulator[21785]: segfault at 7f218cdca011 ip 00007f218ce5d348 sp 00007ffffd122a98 error 4 in libswscale.so.5.9.100[7f218cdf2000+75000]
[17431.213616] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17431.213648] audit: type=1701 audit(1621440398.378:242): auid=1000 uid=1000 gid=1000 ses=1 pid=21785 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17431.223086] audit: type=1334 audit(1621440398.388:243): prog-id=79 op=LOAD
[17431.223210] audit: type=1334 audit(1621440398.388:244): prog-id=80 op=LOAD
[17431.223272] audit: type=1334 audit(1621440398.388:245): prog-id=81 op=LOAD
[17431.224003] audit: type=1130 audit(1621440398.392:246): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@12-21817-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17433.560362] audit: type=1131 audit(1621440400.725:247): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@12-21817-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17433.620924] audit: type=1334 audit(1621440400.788:248): prog-id=81 op=UNLOAD
[17433.620929] audit: type=1334 audit(1621440400.788:249): prog-id=80 op=UNLOAD
[17433.620931] audit: type=1334 audit(1621440400.788:250): prog-id=79 op=UNLOAD
[17636.068527] audit: type=1701 audit(1621440603.236:251): auid=1000 uid=1000 gid=1000 ses=1 pid=22189 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=6 res=1
[17636.075124] audit: type=1334 audit(1621440603.243:252): prog-id=82 op=LOAD
[17636.075299] audit: type=1334 audit(1621440603.243:253): prog-id=83 op=LOAD
[17636.075334] audit: type=1334 audit(1621440603.243:254): prog-id=84 op=LOAD
[17636.075947] audit: type=1130 audit(1621440603.246:255): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@13-22213-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17636.859400] audit: type=1131 audit(1621440604.030:256): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@13-22213-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17636.952582] audit: type=1334 audit(1621440604.123:257): prog-id=84 op=UNLOAD
[17636.952586] audit: type=1334 audit(1621440604.123:258): prog-id=83 op=UNLOAD
[17636.952587] audit: type=1334 audit(1621440604.123:259): prog-id=82 op=UNLOAD
[17683.442450] Slimulator[22349]: segfault at 7fce7b840011 ip 00007fce7b8d3348 sp 00007ffdf12fde88 error 4 in libswscale.so.5.9.100[7fce7b868000+75000]
[17683.442461] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17683.442489] audit: type=1701 audit(1621440650.613:260): auid=1000 uid=1000 gid=1000 ses=1 pid=22349 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17683.451485] audit: type=1334 audit(1621440650.620:261): prog-id=85 op=LOAD
[17683.451530] audit: type=1334 audit(1621440650.620:262): prog-id=86 op=LOAD
[17683.451561] audit: type=1334 audit(1621440650.620:263): prog-id=87 op=LOAD
[17683.452200] audit: type=1130 audit(1621440650.620:264): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@14-22400-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17685.702716] audit: type=1131 audit(1621440652.873:265): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@14-22400-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17685.789205] audit: type=1334 audit(1621440652.960:266): prog-id=87 op=UNLOAD
[17685.789209] audit: type=1334 audit(1621440652.960:267): prog-id=86 op=UNLOAD
[17685.789211] audit: type=1334 audit(1621440652.960:268): prog-id=85 op=UNLOAD
[17741.587367] audit: type=1701 audit(1621440708.757:269): auid=1000 uid=1000 gid=1000 ses=1 pid=22506 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=6 res=1
[17741.597924] audit: type=1334 audit(1621440708.767:270): prog-id=88 op=LOAD
[17741.597991] audit: type=1334 audit(1621440708.767:271): prog-id=89 op=LOAD
[17741.598017] audit: type=1334 audit(1621440708.767:272): prog-id=90 op=LOAD
[17741.598635] audit: type=1130 audit(1621440708.770:273): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@15-22533-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17743.536566] audit: type=1131 audit(1621440710.707:274): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@15-22533-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17743.645445] audit: type=1334 audit(1621440710.817:275): prog-id=90 op=UNLOAD
[17743.645456] audit: type=1334 audit(1621440710.817:276): prog-id=89 op=UNLOAD
[17743.645460] audit: type=1334 audit(1621440710.817:277): prog-id=88 op=UNLOAD
[17826.501073] Slimulator[22630]: segfault at 7efff17b2011 ip 00007efff1845348 sp 00007ffe58353908 error 4 in libswscale.so.5.9.100[7efff17da000+75000]
[17826.501081] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[17826.501144] audit: type=1701 audit(1621440793.671:278): auid=1000 uid=1000 gid=1000 ses=1 pid=22630 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[17826.508176] audit: type=1334 audit(1621440793.681:279): prog-id=91 op=LOAD
[17826.508254] audit: type=1334 audit(1621440793.681:280): prog-id=92 op=LOAD
[17826.508285] audit: type=1334 audit(1621440793.681:281): prog-id=93 op=LOAD
[17826.508907] audit: type=1130 audit(1621440793.681:282): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@16-22667-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17828.821665] audit: type=1131 audit(1621440795.994:283): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@16-22667-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[17828.911512] audit: type=1334 audit(1621440796.084:284): prog-id=93 op=UNLOAD
[17828.911523] audit: type=1334 audit(1621440796.084:285): prog-id=92 op=UNLOAD
[17828.911528] audit: type=1334 audit(1621440796.084:286): prog-id=91 op=UNLOAD
[18255.197203] Slimulator[23128]: segfault at 7f44e8746011 ip 00007f44e87d9348 sp 00007ffdfc25d318 error 4 in libswscale.so.5.9.100[7f44e876e000+75000]
[18255.197213] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[18255.197237] audit: type=1701 audit(1621441222.370:287): auid=1000 uid=1000 gid=1000 ses=1 pid=23128 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[18255.205057] audit: type=1334 audit(1621441222.376:288): prog-id=94 op=LOAD
[18255.205138] audit: type=1334 audit(1621441222.376:289): prog-id=95 op=LOAD
[18255.205165] audit: type=1334 audit(1621441222.376:290): prog-id=96 op=LOAD
[18255.206164] audit: type=1130 audit(1621441222.380:291): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@17-23164-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18257.792719] audit: type=1131 audit(1621441224.967:292): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@17-23164-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18257.862155] audit: type=1334 audit(1621441225.037:293): prog-id=96 op=UNLOAD
[18257.862159] audit: type=1334 audit(1621441225.037:294): prog-id=95 op=UNLOAD
[18257.862161] audit: type=1334 audit(1621441225.037:295): prog-id=94 op=UNLOAD
[18312.879423] audit: type=1334 audit(1621441280.053:296): prog-id=97 op=LOAD
[18312.879566] audit: type=1334 audit(1621441280.053:297): prog-id=98 op=LOAD
[18312.879634] audit: type=1334 audit(1621441280.053:298): prog-id=99 op=LOAD
[18312.918107] audit: type=1130 audit(1621441280.090:299): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18342.984220] audit: type=1131 audit(1621441310.157:300): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18343.084948] audit: type=1334 audit(1621441310.260:301): prog-id=99 op=UNLOAD
[18343.084955] audit: type=1334 audit(1621441310.260:302): prog-id=98 op=UNLOAD
[18343.084959] audit: type=1334 audit(1621441310.260:303): prog-id=97 op=UNLOAD
[18527.198876] Slimulator[23504]: segfault at 7fd59543e011 ip 00007fd5954d1348 sp 00007ffcc5d59e78 error 4 in libswscale.so.5.9.100[7fd595466000+75000]
[18527.198885] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[18527.198911] audit: type=1701 audit(1621441494.371:304): auid=1000 uid=1000 gid=1000 ses=1 pid=23504 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[18527.207861] audit: type=1334 audit(1621441494.381:305): prog-id=100 op=LOAD
[18527.207959] audit: type=1334 audit(1621441494.381:306): prog-id=101 op=LOAD
[18527.207996] audit: type=1334 audit(1621441494.381:307): prog-id=102 op=LOAD
[18527.208682] audit: type=1130 audit(1621441494.381:308): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@18-23538-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18530.192509] audit: type=1131 audit(1621441497.364:309): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@18-23538-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18530.274214] audit: type=1334 audit(1621441497.448:310): prog-id=102 op=UNLOAD
[18530.274221] audit: type=1334 audit(1621441497.448:311): prog-id=101 op=UNLOAD
[18530.274224] audit: type=1334 audit(1621441497.448:312): prog-id=100 op=UNLOAD
[18788.989941] i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe B (start=1126979 end=1126980) time 153 us, min 1073, max 1079, scanline start 1072, end 1082
[18793.024933] audit: type=1334 audit(1621441760.199:313): prog-id=103 op=LOAD
[18793.025042] audit: type=1334 audit(1621441760.199:314): prog-id=104 op=LOAD
[18793.025082] audit: type=1334 audit(1621441760.199:315): prog-id=105 op=LOAD
[18793.061481] audit: type=1130 audit(1621441760.235:316): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18823.124309] audit: type=1131 audit(1621441790.299:317): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[18823.193828] audit: type=1334 audit(1621441790.369:318): prog-id=105 op=UNLOAD
[18823.193847] audit: type=1334 audit(1621441790.369:319): prog-id=104 op=UNLOAD
[18823.193856] audit: type=1334 audit(1621441790.369:320): prog-id=103 op=UNLOAD
[19615.817516] Slimulator[24574]: segfault at 7fb94cbbd011 ip 00007fb94cc50348 sp 00007fffefd935c8 error 4 in libswscale.so.5.9.100[7fb94cbe5000+75000]
[19615.817524] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[19615.817544] audit: type=1701 audit(1621442582.996:321): auid=1000 uid=1000 gid=1000 ses=1 pid=24574 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[19615.825508] audit: type=1334 audit(1621442583.002:322): prog-id=106 op=LOAD
[19615.825620] audit: type=1334 audit(1621442583.002:323): prog-id=107 op=LOAD
[19615.825652] audit: type=1334 audit(1621442583.002:324): prog-id=108 op=LOAD
[19615.826425] audit: type=1130 audit(1621442583.006:325): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@19-24609-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[19617.863304] audit: type=1131 audit(1621442585.043:326): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@19-24609-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[19617.939124] audit: type=1334 audit(1621442585.119:327): prog-id=108 op=UNLOAD
[19617.939129] audit: type=1334 audit(1621442585.119:328): prog-id=107 op=UNLOAD
[19617.939132] audit: type=1334 audit(1621442585.119:329): prog-id=106 op=UNLOAD
[20633.629288] Slimulator[25687]: segfault at 7fed842b8011 ip 00007fed8434b348 sp 00007ffcbf0f45d8 error 4 in libswscale.so.5.9.100[7fed842e0000+75000]
[20633.629298] Code: 45 85 c0 0f 8e 58 01 00 00 41 8d 40 ff 49 89 cc 48 89 d5 48 89 f9 48 89 44 24 f8 44 89 c0 31 f6 48 89 44 24 e0 0f 1f 44 00 00 <0f> b6 41 01 44 0f b6 41 02 48 83 c1 06 44 8b 7c 24 d4 8b 54 24 d8
[20633.629328] audit: type=1701 audit(1621443600.811:330): auid=1000 uid=1000 gid=1000 ses=1 pid=25687 comm="Slimulator" exe="/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator" sig=11 res=1
[20633.640886] audit: type=1334 audit(1621443600.824:331): prog-id=109 op=LOAD
[20633.640985] audit: type=1334 audit(1621443600.824:332): prog-id=110 op=LOAD
[20633.641017] audit: type=1334 audit(1621443600.824:333): prog-id=111 op=LOAD
[20633.641934] audit: type=1130 audit(1621443600.824:334): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@20-25722-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[20636.303870] audit: type=1131 audit(1621443603.488:335): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@20-25722-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[20636.410990] audit: type=1334 audit(1621443603.594:336): prog-id=111 op=UNLOAD
[20636.411006] audit: type=1334 audit(1621443603.594:337): prog-id=110 op=UNLOAD
[20636.411014] audit: type=1334 audit(1621443603.594:338): prog-id=109 op=UNLOAD
radek-k commented 3 years ago

bitmap.UnlockBits() method should be called after encoding the frame.

public void AddFrame(Bitmap frame) {
    Rectangle rect = new Rectangle(System.Drawing.Point.Empty, bitmap.Size);
    BitmapData bitLock = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
    ImageData bitmapImageData = ImageData.FromPointer(bitLock.Scan0, ImagePixelFormat.Bgr24, bitmap.Size);
    buffer.Video.AddFrame(bitmapImageData);
    bitmap.UnlockBits(bitLock);
}

This code works.

yagarea commented 3 years ago

Awesome!
thank you for help.