ksseverson57 / campy

Python package for streaming video from multiple cameras to disk. Features real-time compression and debayering using FFmpeg.
MIT License
37 stars 18 forks source link

exception 'NSInternalInconsistencyException' #15

Closed Piotr-23 closed 11 months ago

Piotr-23 commented 1 year ago

Hi, using:

This beginner-level config uses the CPU (gpuID: -1)

to compress RGB video

using ffmpeg's X264 codec

Recording parameters

videoFolder: "/Users/piotr/basler_984" videoFilename: "984.mp4" frameRate: 10 recTimeInSec: 5

Camera parameters

numCams: 1 cameraMake: "basler" cameraSettings: "./configs/mono8.pfs" frameWidth: 640

1152

frameHeight: 480

1024

recTimeInSec: 3

Compression parameters

gpuID: -1 pixelFormatInput: "gray"

rgb24"

pixelFormatOutput: "rgb0" quality: 17 ffmpegLogLevel: "warning"

ffmpegPath: "/Users/piotr/anaconda3/envs/campy/bin/ffmpeg"

"/usr/bin/ffmpeg" # Location of ffmpeg binary if not using Anaconda

Display parameters

displayFrameRate: 10

Trigger parameters

cameraTrigger: "software"

I am getting:

(campy) Piotrs-MacBook-Pro:campy piotr$ campy-acquire /Users/piotr/campy/configs/campy_config.yaml Opened: /Users/piotr/basler_984/Camera0/984.mp4 using CPU to compress the stream. -vsync is deprecated. Use -fps_mode Passing a number to -vsync is deprecated, use a string argument as described in the manual. 2023-06-14 23:30:35.878 python3.8[33737:1177938] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' First throw call stack: ( 0 CoreFoundation 0x0000000195083154 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000194ba24d4 objc_exception_throw + 60 2 CoreFoundation 0x00000001950ac3a0 _CFBundleGetValueForInfoKey + 0 3 AppKit 0x000000019824ca00 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 320 4 AppKit 0x000000019823acd4 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 816 5 AppKit 0x000000019823a998 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48 6 AppKit 0x000000019849a124 -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 24 7 libqcocoa.dylib 0x000000016232159c qt_plugin_instance + 132188 8 QtWidgets.abi3.so 0x000000016966a31c _ZL17meth_QWidget_showP7objectS0 + 96 9 python3.8 0x0000000104ea4428 cfunction_call_varargs + 360 10 python3.8 0x0000000104ea3af0 _PyObject_MakeTpCall + 744 11 python3.8 0x0000000104f90158 call_function + 612 12 python3.8 0x0000000104f8c83c _PyEval_EvalFrameDefault + 27176 13 python3.8 0x0000000104ea47b4 function_code_fastcall + 128 14 python3.8 0x0000000104f900c0 call_function + 460 15 python3.8 0x0000000104f8c818 _PyEval_EvalFrameDefault + 27140 16 python3.8 0x0000000104f857fc _PyEval_EvalCodeWithName + 3008 17 python3.8 0x0000000104ea4918 _PyFunction_Vectorcall + 208 18 python3.8 0x0000000104ea7ea4 method_vectorcall + 520 19 python3.8 0x0000000104ea3fd8 PyVectorcall_Call + 120 20 python3.8 0x0000000104f8caf0 _PyEval_EvalFrameDefault + 27868 21 python3.8 0x0000000104f857fc _PyEval_EvalCodeWithName + 3008 22 python3.8 0x0000000104ea4918 _PyFunction_Vectorcall + 208 23 python3.8 0x0000000104f900c0 call_function + 460 24 python3.8 0x0000000104f8c934 _PyEval_EvalFrameDefault + 27424 25 python3.8 0x0000000104ea47b4 function_code_fastcall + 128 26 python3.8 0x0000000104f900c0 call_function + 460 27 python3.8 0x0000000104f8c8b8 _PyEval_EvalFrameDefault + 27300 28 python3.8 0x0000000104ea47b4 function_code_fastcall + 128 29 python3.8 0x0000000104ea3fd8 PyVectorcall_Call + 120 30 python3.8 0x0000000104f8caf0 _PyEval_EvalFrameDefault + 27868 31 python3.8 0x0000000104ea47b4 function_code_fastcall + 128 32 python3.8 0x0000000104f900c0 call_function + 460 33 python3.8 0x0000000104f8c818 _PyEval_EvalFrameDefault + 27140 34 python3.8 0x0000000104ea47b4 function_code_fastcall + 128 35 python3.8 0x0000000104f900c0 call_function + 460 36 python3.8 0x0000000104f8c818 _PyEval_EvalFrameDefault + 27140 37 python3.8 0x0000000104ea47b4 function_code_fastcall + 128 38 python3.8 0x0000000104ea7de8 method_vectorcall + 332 39 python3.8 0x0000000104ea3fd8 PyVectorcall_Call + 120 40 python3.8 0x000000010504b8e4 t_bootstrap + 196 41 python3.8 0x0000000104fe75d8 pythread_wrapper + 48 42 libsystem_pthread.dylib 0x0000000194f2bfa8 _pthread_start + 148 43 libsystem_pthread.dylib 0x0000000194f26da0 thread_start + 8 ) libc++abi: terminating due to uncaught exception of type NSException [vost#0:0/libx264 @ 0x1426062d0] One of -r/-fpsmax was specified together a non-CFR -vsync/-fps_mode. This is contradictory.

This is on Mac. Can you help, please? Thanks!

Piotr-23 commented 1 year ago

2023-06-17 22:36:04.566 python[4241:35549] WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future. Called from ( 0 AppKit 0x00007ff81067721d -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 338 1 AppKit 0x00007ff810663714 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1227 2 AppKit 0x00007ff810663242 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42 3 AppKit 0x00007ff81092e323 -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 50 4 libqcocoa.dylib 0x0000000177fde725 -[QNSWindow initWithContentRect:styleMask:backing:defer:screen:platformWindow:] + 197 5 libqcocoa.dylib 0x0000000177fcbcac _ZN12QCocoaWindow14createNSWindowEb + 1324 6 libqcocoa.dylib 0x0000000177fc5672 _ZN12QCocoaWindow22recreateWindowIfNeededEv + 1266 7 libqcocoa.dylib 0x0000000177fc50fe _ZN12QCocoaWindow10initializeEv + 318 8 QtGui 0x0000000178672eb7 _ZN14QWindowPrivate6createEby + 151 9 QtWidgets 0x000000017a2bf771 _ZN14QWidgetPrivate6createEv + 1185 10 QtWidgets 0x000000017a2be414 _ZN7QWidget6createEybb + 324 11 QtWidgets 0x000000017a2d181d _ZN14QWidgetPrivate10setVisibleEb + 189 12 QtWidgets.abi3.so 0x000000017967e93f _ZN14sipQMainWindow10setVisibleEb + 111 13 QtWidgets.abi3.so 0x000000017983a34b _ZL17meth_QWidget_showP7objectS0 + 75 14 python3.7 0x0000000102df6cae call_function + 3182 15 python3.7 0x0000000102de287c _PyEval_EvalFrameDefault + 45468 16 python3.7 0x0000000102cb169e _PyFunction_FastCallKeywords + 398 17 python3.7 0x0000000102de025d _PyEval_EvalFrameDefault + 35709 18 python3.7 0x0000000102dd4b35 _PyEval_EvalCodeWithName + 677 19 python3.7 0x0000000102cb84d1 _PyObject_Call_Prepend + 1553 20 python3.7 0x0000000102de15b1 _PyEval_EvalFrameDefault + 40657 21 python3.7 0x0000000102df6969 call_function + 2345 22 python3.7 0x0000000102ddbabd _PyEval_EvalFrameDefault + 17373 23 python3.7 0x0000000102df626b call_function + 555 24 python3.7 0x0000000102ddef39 _PyEval_EvalFrameDefault + 30809 25 python3.7 0x0000000102de233a _PyEval_EvalFrameDefault + 44122 26 python3.7 0x0000000102cb169e _PyFunction_FastCallKeywords + 398 27 python3.7 0x0000000102de025d _PyEval_EvalFrameDefault + 35709 28 python3.7 0x0000000102cb169e _PyFunction_FastCallKeywords + 398 29 python3.7 0x0000000102de025d _PyEval_EvalFrameDefault + 35709 30 python3.7 0x0000000102cb81d1 _PyObject_Call_Prepend + 785 31 python3.7 0x0000000102cb5124 PyObject_Call + 116 32 python3.7 0x0000000102ea90db t_bootstrap + 171 33 python3.7 0x0000000102e4af74 pythread_wrapper + 36 34 libsystem_pthread.dylib 0x00007ff80d5831d3 _pthread_start + 125 35 libsystem_pthread.dylib 0x00007ff80d57ebd3 thread_start + 15 ) 2023-06-17 22:36:04.632 python[4241:35549] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future. 2023-06-17 22:36:04.633 python[4241:35549] Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117 2023-06-17 22:36:04.642 python[4241:35549] Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117 2023-06-17 22:36:04.643 python[4241:35549] Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117 2023-06-17 22:36:04.644 python[4241:35549] Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117 2023-06-17 22:36:04.645 python[4241:35549] Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117 2023-06-17 22:36:04.646 python[4241:35549] Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117

ksseverson57 commented 11 months ago

Although Campy has not been tested on Mac, the error messages appear to be a an issue within display.py or perhaps DisplayImage within basler.py to dispaly the images with the matplotlib window. Please try installing campy in the AV1 beta branch, which now uses an opencv display window and has better error handling

Piotr-23 commented 11 months ago

Thanks for your response! Since June, we have been able to use Campy on Mac to successfully record several 45-min videos from 3 Basler cameras at 60 fps! While the error remains, the videos are OK. The only difference between Mac and Windows is that, on Windows one can see the windows showing what the cameras see, while in Mac, perhaps due to this installation problems, we do not see them. As to the AV1 beta - sorry I do not understand... bud gladly learn how to do that. Thanks | Piotr

ksseverson57 commented 11 months ago

The AV1 branch is here if you want to try the newer version: https://github.com/ksseverson57/campy/tree/AV1

Glad to hear you got campy working on Mac! I can now say campy with Basler cameras is compatible with Mac thanks to you. Hopefully the new branch is also compatible, which might require some changes to your config file and the trigger module if you are using "trigger.ino" to sync your cameras

Piotr-23 commented 11 months ago

Yes, we use Arduino for cameras synchronization. I think the initial problem (sorry, it was a long time ago) was with brew / python installation: a helpful trick for the Mac users: when moving from an old Mac architecture to the novel, and simply copying all packages, remember to install python for the novel architecture!

I think the lack of camera display is due to qt@5 - whatever that is - problems....

While I have little knowledge in programming, following proper python installation, we were able to use Campy. Just let me know if I can be of any help.

As to the novel Campy version: one day I'll give a try, because we use the system almost everyday for animal research, and have to have it working, even with limited capabilities. Anyway: thank you Kyle for your fantastic work | Piotr

ksseverson57 commented 11 months ago

thank you again for raising the issue and including all relevant information to isolate the problem. Sorry for taking so long to respond. I'm busy with experiments, too. If your campy recording is working, no need to change anything. Good luck with everything Piotr!