My team has been trying unsuccessfully for the last two years to get the Axis camera to work with the WPICamera extension in SmartDashboard.
I started the dashboard from the command line in order to see error output, and I have been consistently seeing this error for some unknown reason:
edu.wpi.first.wpijavacv.WPICamera$BadConnectionException
at edu.wpi.first.wpijavacv.WPICamera.getNewImage(WPICamera.java:128)
at edu.wpi.first.smartdashboard.camera.WPICameraExtension$BGThread.run(WPICameraExtension.java:68
[mjpeg @ 04BE2D70] max_analyze_duration reached
[mjpeg @ 04BE2D70] Estimating duration from bitrate, this may be inaccurate
Input #0, mjpeg, from 'http://10.13.50.11/mjpg/video.mjpg':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 320x240 [PAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 25 tbc
[swscaler @ 0A16C470] No accelerated colorspace conversion found from yuv420p to bgr24.
This repeats over and over. It clearly gets a valid stream from the referenced link, as that resolution is correct. I’m hoping that Brad Miller or someone familiar with the source might be able to lend some insight here.
Time is running short to actually start testing algorithms and our shooting platform, so a fast response would be very much appreciated.
If the sources are available for the WPIJavaCV library I would be willing to dive into that to try and debug what is happening. It appears that none of the code is available at FirstForge, which really surprises me (or at least it’s not allowing my user account there any access).
If I leave the dashboard up for a long time (several minutes), it eventually seems to grab a connection to the camera and displays fine from that point on.
Perhaps some issue with a timeout not being set generously enough? Our camera’s frame rate can sometimes hiccup when being viewed from a browser, but I don’t see why that would cause connection issues.
Yeah, we’re having similar issues. Works fine with the M1011, 206 is quite intermittent.
On our Thursday meeting we had the 206 in working order (however with some occasional connection failures), came back this morning with output cycling between “No accelerated colorspace” and connection failure.
Ah, well this is good news then. We just ordered an M1011 to have a backup camera for competition and to test that the issue wasn’t with our 206. Hopefully we will have the same experience as you and the M1011 will work consistently.
Do you happen to know if the source for WPIJavaCV + WPICameraExtension is available? I would really like to get to the bottom of its behavior with the 206. I also have reason to believe that there’s a resource leak in the code as well. Running for ~20 minutes after streaming begins results in SmartDashboard crashing with a DirectByteBuffer.get call failing.
We’ve received an M1011 camera and confirmed that the 206 is indeed a very unreliable camera for connecting to SmartDashboard. The new camera works every time that we boot up a WPICameraExtension widget.
I am having the same issue exactly as described in the original post in this thread. It was working intermitently over the last few days (more working than not) but as of last night it does not want to work at all. I tried a different laptop and see the same issue. It is clear that ffmpeg is able to talk to the camera because if I change the resolution of the video feed thru the web browser interface than I can see the resolution change in the error message that ffmpeg is spitting out. I am using a M1013 camera. Is anyone else using M1013 camera with success? Or can anyone confirm that M1013 is not working for them?
It definitely seems like there’s a good amount of flakiness with the WPICameraExtension. I’m disheartened that the author has yet to post; all I would like is the source to this to be able to debug the issue for everyone that’s facing it.
It may even be something as simple as a connection timeout that needs to be adjusted - because once the feed is established it remains up without issue, correct?
If someone is aware of who the author is (Brad Miller?), can someone PM him to please take a look at this thread?
EDIT: Or if someone is aware of how to obtain the source to build everything, that works too.
As an attempt at troubleshooting this issue I thought of trying to run ffmpeg (actually ended up using ffplay) directly from the command line to see if I could get the camera to stream that way. I used the following command:
The ffplay window comes up and plays video for a few seconds and then freezes! To me this means there is some incompatibility between ffmpeg (at least with the arguments we are supplying) and the Axis camera. This should be a good technique for finding if there are some additional parameters we can pass to ffmpeg to keep a stable stream coming. Any ffmpeg gurus out there that can suggest some params to try?
Our team is having the same kinds of problems. SmartDashboard crashes and camera feed issues. I don’t know enough about either to do useful debug, but I did figure out how to get to the SmartDashboard source code. I’ve attached a document explaining how to use it from NetBeans. It may not be 100% correct, but should be enough to get you going. I don’t know what version of source was used to build the 1.0.4 installer; it doesn’t seem to be documented anywhere… Hope someone can actually FIX the problem!
Kevin O’Connor stated that the issue is known and a fix is in the works. It may help to make any camera setting changes you can to improve the frame rate form the camera, as the issue appears more often when the frame rate drops below 25fps. I noticed the feed is much smoother on the 1011 than the 206 when viewing from a browser.
Once my team’s code is complete I can dedicate some time to trying to debug the extension, but hopefully this will help anyone else experiencing the issue in the meantime.