gstreamer-imx icon indicating copy to clipboard operation
gstreamer-imx copied to clipboard

Compatibility Problem: imxvpuenc_mjpeg does not create a JFIF marker (FFE0)

Open moberhuber opened this issue 5 years ago • 2 comments

Hello,

We are using gstreamer_imx on an embedded device to stream HTTP/MJPEG. It turned out that a customer's browser doesn't accept the imxvpuenc_mjpeg stream while it does accept the software-encoded jpegenc stream. We think that the problem is a missing JPEG JFIF marker in the data stream. We tried adding the tag with jifmux but that didn't work:

GST_DEBUG=2,jifmux:6 gst-launch-1.0 imxv4l2videosrc device=/dev/video0 imx-capture-mode=0 queue-size=6 ! imxipuvideotransform ! video/x-raw,width=640,height=480 ! imxvpuenc_mjpeg ! jpegparse ! jifmux ! multipartmux boundary=spionisto name=multipartmux ! multisocketsink name=multisocketsink

Apparently jifmux only adds the required marker if it knows from markers that the stream is YUV or greyscale ... but those markers are missing in the stream.

Since the JPEG produced by imxvpuenc_mjpeg is obviously valid JFIF, we're wondering if that tag could be added, such that the result is more compatible?

moberhuber avatar Oct 10 '19 16:10 moberhuber

@dv1 , do we have JPEF JFIF marker in the data stream for imxvpuenc_mjpeg in the current source code?

angolini avatar Aug 18 '21 15:08 angolini

Indeed, the imx6 CODA VPU is producing weird JPEG data. The jpeginfo tool reports the produced JPEG as being invalid. Not sure what can be done here. Perhaps the bitstream can be modified.

dv1 avatar Apr 15 '22 20:04 dv1

No way was found to make the VPU produce the APP0 segment, so it is inserted manually. Note that this is a fix in libimxvpuapi, so anyone affected by this issue needs to make sure to use latest git master (or the upcoming 2.3.0 libimxvpuapi release or later).

dv1 avatar Jul 25 '23 08:07 dv1