Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
183 stars 127 forks source link

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

Closed moberhuber closed 1 year ago

moberhuber commented 4 years ago

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?

angolini commented 3 years ago

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

dv1 commented 2 years ago

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 commented 1 year ago

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).