Video signal (webcam ) freezes

I have a an application that simply processes a webcam feed applying different filter effects. After running for several hours the incoming video signal from the webcam seems to ‘freeze’. ie the application still works, filter effects work, frame rate is unchanged, but the incoming ‘video’ signal is frozen on a still image.

I am perplexed as to what might be causing this and how to troubleshoot. I also need to deploy this in the next day or so so am starting to panic:(

This is in OSX using v 0.84 release version of OFX and a Logitech C930 webcam

After reading this

I’ve added
ofSetLogLevel(OF_LOG_VERBOSE);
to my ofApp setup and will post the log file if when the video freezes again, but in the meantime can anyone suggest additional troubleshooting steps I might try?

Hi, ah shit sorry to hear that, deadline panic sucks.

Do you know if the application thinks it is getting new video frames from the framegrabber? For now I’d throw some big warning all over the place if you haven’t received a new frame in the last half second or so.

I’m guessing your are not running through a USB splitter or extender or anything like this? Worth testing without it if you are. If there is a dip in the level of power coming through USB or anything like that it could kill your video stream.

Do you have another machine to try this on? Could help with narrowing things down.

If you can detect that you are no longer getting video through then at least as an ugly hack you can exit the app, if you have set up the machine to keep the app running it’ll start back up again, it’ll be offline for like 10 seconds.

https://github.com/laserpilot/Installation_Up_4evr/blob/master/Installation_Up_4evr.md

on pc I’ve look at things like “energy saver” on the usb port when things freeze. Also, I’ve had good luck with a powered usb hub / active usb extension cable.

As a test, could you try closing and reopening the video camera via key press, then if it freezes, see if it resumes normally? (ie, don’t even quit the app but just close and reopen the video grabber).

Could you try porting your app to the current release 0.9.0

The issue may be fixed there.
Thanks!
Theo

Appreciate all the feedback! Reminds me of why I won’t hesitate to consider OF for my next project.

Running off a Mac Mini and only average 12 fps during the more CPU intensive portions of the running app so that may be part of the problem
Right now trying to find a way to reliably duplicate the issue.
(Noob) question
If I am calling _videoGrabberInstance.initGrabber(vidWidth, vidHeight); in my setup where-how would I add the keypress code to open and close the videoGrabber?

Also, difficult question to answer without posting all my code, but if I am trying to log to an external file via ofLogToFile(), which specific methods relating to the videograbber should I be logging?

I’ll keep trying to break the app manually and post any helpful info I come across.

@eco_bach1 some things I would look at to debug this:

  • do you have any other USB devices plugged in, that could be shorting the USB bus ( Griffen Powermate USB knobs are famous at doing this )
  • do you have the Energy Saver settings in OS X set to do anything funny after a certain time?
  • a REALLY helpful way to catch an issue like this is if you are running it from Xcode, when it freezes first check if there is any messages in the console ( avoid ofLogtoFile in this case, so the messages come through ), then hit the pause button in the debugger.

If a thread is hanging you should be able to see where its stuck ( this will only work if its actually hanging and probably not work if the device is simply not delivering frames ).

One other thing to test - which would really help debug the issue, is can you simply run the videoGrabber example from the 0.8.4 examples. Run it overnight and see if it also freezes. This would help identify if the issues is with your code or OF.

Hope that helps!
Theo

I realize that this isn’t timely info, but I recently had the same issue with qtKit grabber.

to solve I switched to av foundation by using https://github.com/roxlu/video_capture which using avFoundation – here’s a very primitive threading of @roxlu’s grabber code:

my YUYV422 -> grayscale needs love (it should be much more accurate to convert to RGB and then to grayscale) but beyond that it seem to work pretty well and not freeze up as the qt kit was doing.