loading
 
Feed RoboRealm webserver video to FRC SmartDashboard
Anonymous
5 years
FRC SmartDashboard has a simple FFmpeg grabber extension (VideoStreamExtension) that can read mjpeg streams from a web server URL.

We tried to connect it to RoboRealm (http://localhost:8080/mjpeg.cgi), but it ran into an error below.   (Other mjpeg feeds seems to be okay.)

If you can take a look at the error reported by JavaCV, it would be great!

Billy.

[ingenient @ 04412BA0] Could not find codec parameters (Video: mjpeg)
[ingenient @ 04412BA0] Estimating duration from bitrate, this may be inaccurate
java.lang.Exception: Could not find stream information.
        at com.googlecode.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.jav
a:142)
        at edu.wpi.first.wpijavacv.WPIFFmpegVideo$1.run(WPIFFmpegVideo.java:27)
edu.wpi.first.wpijavacv.WPIFFmpegVideo$BadConnectionException
        at edu.wpi.first.wpijavacv.WPIFFmpegVideo.getNewImage(WPIFFmpegVideo.jav
a:111)
        at edu.wpi.first.smartdashboard.camera.VideoStreamExtension$BGThread.run
(VideoStreamExtension.java:65)
Steven Gentner from United States  [1387 posts] 5 years
Hi,

Just to be sure, the SDB does have the ability to add a 'Camera' and set that url directly to RR too. You'd just need to change the RR webserver port from 8080 to 80. You do this in the Options button->Web server tab->Port. Note that you have to wait a couple seconds before seeing the video in the SDB.

We're having some problems finding all the bits and pieces needed to test your issue directly. Are you able to zip up your code and post it here? That would help us recreate the problem and see what the issue might be.

thanks,
STeven.
Billy Lo from Canada  [5 posts] 5 years
Here is how to setup my environment.

1) Get Smartdashboard installer.
2) Copy the attached jar to \Program Files\SmartDashboard\extensions
3) Restart SmartDashboard

Thanks!
Billy Lo from Canada  [5 posts] 5 years
Here is how to setup my environment.

1) Get Smartdashboard installer.
2) Unzip the attached jar to \Program Files\SmartDashboard\extensions
3) Restart SmartDashboard (using command line, java -jar SmartDashboard.jar)
4) Turn on RoboRealm web server
5) Add VideoStream extension and adjust URL to http://localhost:8080/mjpeg.cgi
6) You should be able to see the exception above.

Thanks!
VideoStreamExtension.jar.zip
Shawn T. Lim from Canada  [1 posts] 5 years
In addition, we have also tried the built-in "Camera" widget included in SDB 1.0.4 and pointed it to the RoboRealm computer's IP. We did change the port of the webserver from 8080 to 80, and tested that the webserver is functioning with a browser.

We get the same error as above:
[mjpeg @ 067C72B0] Could not find codec parameters (Video: mjpeg)
[mjpeg @ 067C72B0] Estimating duration from bitrate, this may be inaccurate
java.lang.Exception: Could not find stream information.
        at com.googlecode.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.jav
a:142)
        at edu.wpi.first.wpijavacv.WPICamera$1.run(WPICamera.java:44)
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(W
PICameraExtension.java:68)
Steven Gentner from United States  [1387 posts] 5 years
Shawn & Billy,

Can you download the latest version. We made some updates and have added a minFPS parameter in the Webserver tab under Options. You will need to set that to 25 in order for the stream to be stable. The reason for this is that the Camera and VideoStream require a minimum rate in order to work. At below 20 it seems to start failing so that parameter will send previous frames out to ensure the rate is preserved. Seems to create a more stable connection.

Give things a try and let us know how it goes.

STeven.
Billy Lo from Canada  [5 posts] 5 years
Hi, STeven,   Tried v2.49.8 with minFPS at 25 or 30, still getting errors from SmartDashboard below.  I added one line to VideoStreamExtension to increase mmjpeg logging level to debug.  Not much more information revealed...  any hints?  Thanks. Billy.

C:\Program Files\SmartDashboard>java -jar SmartDashboard.jar
Searching Folder:.\lib
Searching Folder:.\extensions\lib
Adding Jar:.\extensions\lib\javacpp.jar
Adding Jar:.\extensions\lib\javacv-windows-x86.jar
Adding Jar:.\extensions\lib\javacv.jar
Adding Jar:.\extensions\lib\WPIJavaCV.jar
Searching Folder:.\extensions
Adding Jar:.\extensions\VideoStreamExtension.jar
Adding Jar:.\extensions\WPICameraExtension.jar
Searching Jar:.\extensions\VideoStreamExtension.jar
Custom Static Widget:VideoStreamExtension
Searching Jar:.\extensions\WPICameraExtension.jar
Custom Static Widget:WPICameraExtension
Custom Static Widget:WPILaptopCameraExtension
Host: 10.6.10.2

Loading from    C:\Users\billylo\SmartDashboard\save.xml

Loading SmartDashboard widgets....
Current log level = 32, Setting loglevel to 48 and path = http://localhost:8080
mjpeg.cgi
edu.wpi.first.wpijavacv.WPIFFmpegVideo$BadConnectionException
        at edu.wpi.first.wpijavacv.WPIFFmpegVideo.getNewImage(WPIFFmpegVideo.ja
a:111)
        at edu.wpi.first.smartdashboard.camera.VideoStreamExtension$BGThread.ru
(VideoStreamExtension.java:74)
Probed with size=2048 and score=50
[ingenient @ 048312F0] Could not find codec parameters (Video: mjpeg)
[ingenient @ 048312F0] Estimating duration from bitrate, this may be inaccurate
java.lang.Exception: Could not find stream information.
        at com.googlecode.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.ja
a:142)
        at edu.wpi.first.wpijavacv.WPIFFmpegVideo$1.run(WPIFFmpegVideo.java:27)
Current log level = 48, Setting loglevel to 48 and path = http://localhost:8080
mjpeg.cgi
Billy Lo from Canada  [5 posts] 5 years
Okay! Finally found a combination that works now on my webcam.

1)  Install latest RoboRealm 2.49.8
2)  Change RoboRealm web server to run on port 80 and with minFPS 25
3)  Add "Camera" extension to SmartDashboard (not VideoStream)
4)  Change Camera extension properties to point to netbook's IP address

[Additional notes:  do not try to update ffmpeg, opencv or javacv libraries.  SmartDashboard seems to be quite picky; other versions crash SmartDashboard.]

We will test it with the Kinect/Netbook combination later on the robot.  Hopefully, this would allow us to use SmartDashboard with RoboRealm.  Thanks again for your diligent support.
Steven Gentner from United States  [1387 posts] 5 years
Billy,

Thanks for the info. We did see those same errors in both the Camera and VideoStream but with the minimum fps rate added it seemed to solve both. But I did go and upgrade the ffmpeg extension so I probably lost the stock configuration when testing.

One thing I also noticed is that the Camera extension is not 100% stable. There are still cases when something seems to drop and you get the red/pink square in the image's place which I personally found somewhat distracting. It would recover but the sudden blink to red is quite distracting. I've put in a request to FRC to see if that could not be eliminated at least for momentary flickers so as not to distract the driver.

The FPS limitation is definitely a concern. We've not come across any IP viewers that require a standard FPS as the internet itself is notoriously sporadic in terms of a camera feed. Typically these viewers will display images as they get them. Should an image be delayed or the connection is disabled the last image remains. It seems like the Camera extension should also behave like this given the bandwidth restrictions imposed this year. The concern is that as soon as the bandwidth bursts over your limit the camera image will switch to the red disabled view.

So, in a nutshell, look out for this behavior at your local scrimmage and see if it is an issue.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index