userland icon indicating copy to clipboard operation
userland copied to clipboard

mmal fails to decode mjpeg from usb camera

Open linhuifj opened this issue 5 years ago • 0 comments

Example of the frame: example of frame

I have a USB camera that outputs mjpeg frames that fail to be decoded by mmal. I have tried to use hello_mmal_jpeg, hello_mmal_video, and FFmpeg with mmal_mjpeg decoder, none of them is ok.

My experiment environment: Pi 4b, 32bit raspberry pi os

I finally come out with the solution to use mjpeg2jpeg converter in FFmpeg: ./ffmpeg -i ~/raw.jpg -codec copy -bsf:v mjpeg2jpeg yy.jpg I writer a convert by referring to the code in FFmpeg mjpeg2jpeg.

My question:

  1. Is there any better solution?
  2. what's the highest framerate supported by mmal (rpi 4b) to decode video with size 3840x2160? I have tested the decoding of hello_mmal_jpeg and found that it takes about 150ms to decode the image, which is too slow.
  3. Is mjpeg video decoding faster than image decoding?

linhuifj avatar Dec 23 '20 11:12 linhuifj