-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hello_mmal_jpeg fails with images from USB webcam #15
Comments
That's because mjpeg is not well supported by mmal. You can try to convert mjpeg into jpeg format. You can refer to the code of mjpeg2jpeg to write a converter. |
I'd not noticed this issue as it's been raised on my fork of this repo instead of the main raspberrypi/userland. MJPEG is fine with MMAL, although generally via video_decode rather than image_decode. MJPEG is very poorly defined (there is no official spec). There was a fix for decoding some MJPEG files in June 2020 under RPi-Distro/vlc#8 to deal with multiple padding bytes between markers. That may fix your issue. Closing. Please retest with latest firmware and open at raspberrypi/userland if you still see problems. |
In fact, resetting to the latest firmware will not resolve the problem. I have been struggling with this for these days and finally come out with the solution. Some USB camera outputs mjpegs that will be decoded by mmal, but some types of USB camera's output cannot be decoded. |
In which case open a new issue in the correct place with a sample file. |
Describe the bug
Sometimes, perfectly valid jpeg images fail to decode. They come from a USB webcam.
For reference, a typical successful run of the program looks like this:
To reproduce
The above image isn't viewable with most programs. It can be fixed with this ffmpeg command, which turns a Motion JPEG frame into a full JFIF image file:
ffmpeg -i frame-og.jpg -c:v copy -bsf:v mjpeg2jpeg frame-fixed.jpg
Both of them fail when inputted to
hello_mmal_jpeg.bin
. Other images work fine.System
The text was updated successfully, but these errors were encountered: