VCVRack / VCV-Recorder

Other
24 stars 5 forks source link

Crash when recording video on 5K display on Mac #29

Open PaulPomeroy opened 4 years ago

PaulPomeroy commented 4 years ago

Running on Mac Catalina (10.15.1) using the latest VCV and latest versions of all modules. I'm unable to record an MPEG2 video (I'm able to record just audio, however). As soon as I click on the red button VCV crashes. I get a crash report from the OS that indicates:

"*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' Assertion failed: (err >= 0), function open, file src/Recorder.cpp, line 288.

terminating with uncaught exception of type NSException"

First attached file is the crash report. The second file is the patch file.

Rack_2019-11-27-182021_Pauls-iMac.txt

20191127-1-crashes.vcv.txt

PaulPomeroy commented 4 years ago

UPDATE: This appears to have something to do with the window size and/or zoom percent. I've got a 27" iMac and with VCV on a full-sized window the video recording fails. However, I reduced the VCV zoom percent down to 40 and then reduced the window size to match and was able to get the recording to work.

AndrewBelt commented 4 years ago

Can you post the log.txt file in your Rack user directory after it crashes?

PaulPomeroy commented 4 years ago

log.txt

AndrewBelt commented 4 years ago

Not really sure, but since you see a correlation with the window size (and thus video size), perhaps the encoder doesn't support the exact dimensions of the window.

PaulPomeroy commented 4 years ago

So your code isn't doing any resizing? I thought with the "NSWIndow drag" getting mentioned that it might ... that's why I tried it again with the window size and zoom level way down. It's been a couple of decades since I last wrote application software so it was just a wild guess on my part.

Oh. One more factor is that this new computer of mine has the 5K Retina display. The filesizes on the screenshots I do come out HUGE on this thing. It wouldn't surprise me if your code was doing the equivalent of cramming two cups of jello into a one-cup container ...

AndrewBelt commented 4 years ago

No, the output video file is the same dimensions as the window size. Even if encoding a 5K video in real time worked, the performance would be poor.

PaulPomeroy commented 4 years ago

I wanted to record another video today and am unable to get it working, even when doing the things that worked for me a week ago. No crash this time but the video is no good. It looks like it might be okay at first but the sound will cut out after a few seconds. Also, if I look at the mouse pointer in the video I see that it isn't in the right place. For example, at the very beginning of the recording I click on the clock's RUN button but in the video the mouse pointer is several inches away from where the RUN button is. And then, as the video progresses I can also see that the recording speed is off (everything appears to be in slow motion) and the audio, before it simply quits, is not in sync with the video. There are no errors in the log.txt file, so nothing to attach here for you.

I thought this might have something to do with the Rack folder being up on iCloud (as that's where my Documents folder was) so I moved the Documents folder back to the local drive. I also rebooted the computer. Neither of those things helped.

PaulPomeroy commented 4 years ago

A follow on: I changed it so that Rack opens/runs in lo-res mode. That fixed the mouse positioning issue mentioned above, but I get no sound at all now and the video is still playing back in "slo-mo".

PaulPomeroy commented 4 years ago

Video illustrates the problem I'm having. Note that the video length is correct but what it shows is only about half of what I recorded.

FYI, the video here is a "down-res'd" version made with Quicktime (just to lower the file size).

[https://youtu.be/bgZ4Xtq36co]

PaulPomeroy commented 4 years ago

This problem (or problems?) keeps shifting. Today I can't get REC to work at all. I click on the button and it doesn't appear to do anything. However, it creates an empty file (with the name I've selected for the output MPEG). It also leaves a rather cryptic error message in the log (see attached). I've also attached the patch file in case that helps ... I tried all kinds of settings(frame rate, audio rate, zoom %, window size, ...) to no avail. I also shut down and restarted the computer.

log.txt 20191205a4 copy.vcv.txt

PaulPomeroy commented 4 years ago

Okay ... Another piece of data: When I open the video up in Quicktime and then open the "Movie Inspector" window I see an "Encoded FPS" value of 7.5. That seems pretty low to me. Other videos I've recorded have rates up near 60 FPS. That having been said, one of the last videos I managed to record successfully also has an Encoded FPS of 7.5. I don't know how the framerate is being set and/or what VCV Rack setting might be used to change it. It doesn't seem to matter what I set the REC bitrate to.

AndrewBelt commented 4 years ago

Is this issue solved? I made a change at some point to use the memory heap instead of the stack for particular video data, and that could have been the cause and solution of this issue.

PaulPomeroy commented 4 years ago

I'll have to try again. I bought some software (iShowU Instant) to do video/audio recording and have only used the REC module to occasionally grab a sound recording since then. I'll get back to you shortly.

PaulPomeroy commented 4 years ago

Hmmm. Different problem. When I press the REC button nothing appears to happen. However, for every time I press the REC button, it generates an empty .mpg file and writes the following error message to the log:

[47.902 warn src/Recorder.cpp:352] Could not open video encoder: Invalid argument

log.txt

p.s., Audio recording to a wav file works fine.

AndrewBelt commented 4 years ago

What encoder (video format) and settings (e.g. bitrate) are you using when it fails to start recording?

PaulPomeroy commented 4 years ago

It's a freshly initialized instance of the module. I'm selecting the mpeg-2 format. Video is at 2048 kbps. Audio is 256 Kbps.

For what it's worth, trying to record with the lossless (avi) formats generates a whole lot of static noise (cpu overload?). I do get something recorded to the output file but the patch doesn't play (actually, it plays a bit in fits and starts but mostly there's just a lot of clicking/static).

PaulPomeroy commented 4 years ago

Not sure what the relationship is, if any, but I'm using a 48 kHz sample rate and running on a single thread (lowest CPU usage).