"Corrupt JPEG data: 3 extraneous bytes before marker 0xd0" when compressing USB Camera

I’ve made a switchable camera appear on the Shuffleboard and it switches perfectly and shows the cameras just how I want them. However, for only one of the cameras, it spams the console with messages similar to Corrupt JPEG data: 3 extraneous bytes before marker 0xd0. This makes debugging other code difficult.

This only happens when I set the compression level in shuffleboard, or in the code itself. If I don’t set the compression level at all, it never spams the console with that message.

The camera is working perfectly. Is there a way to disable that message or is there something I can change to prevent that message from spamming the console?

What platform is this on? Are you getting those messages on the server (robot) side or on the Shuffleboard side? What version of Shuffleboard/WPILib?

This message is printed out in the console on the driver station, but it only appears when Shuffleboard is open and only when one of the cameras is being viewed. My guess is that it isn’t a problem with shuffleboard, it’s somehow related to it trying to get camera data. I’m not entirely sure.

My version: id "edu.wpi.first.GradleRIO" version "2019.4.1" straight out of my build.gradle. I am, however, on version 2019.3.1 on Shuffleboard which I don’t think is the latest. I can try upgrading that if you think it will fix the problem.

This is a bug in libjpeg in OpenCV. I know the fix but it will require a new wpilib release. Unfortunately there’s no workaround.

1 Like

OK. Thanks for the quick reply.

Do you know if a new version that has this fix will be released before week 3 events start?

We likely will not be rolling another release before then, however you can set up gradlerio to use a new version of opencv be built with the fix. In your build.gradle file somewhere in the root scope, add the following lines.

wpi {
    opencvVersion = "3.4.4-5"

You’ll need to do an online build once to download the artifacts, but that should be good and have the fix.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.