What is the BITSTREAM array format , returned by get data() (videoEncoder source, profile set to VideoEncoderProperties.Profile.MJPEG) ?

this is what is reported for an image that is 640x640, I can't get a reasonable explanation of the numbers?
node.info(f'{jpegImage.getType()} {jpegImage.getWidth()} {jpegImage.getHeight()} {len(img)}')
IMX378 set to 640x640:
Type.BITSTREAM 3497 3504 3497
IMX582 set to 640x640:
Type.BITSTREAM 4892 4896 4892

    Hi @Thor ,
    Width/Height are invalid when dealing with bitstream, and for the format - bitstream is the format.

    Thor
    To add some further explanation (GPT):

    The BITSTREAM array format returned by getData() from a videoEncoder node in DepthAI, especially when the profile is set to VideoEncoderProperties.Profile.MJPEG, represents the encoded video frame data. This data is not in a standard image format (like raw pixels in RGB or grayscale), but rather in a compressed, encoded format.

    Here are the key points to understand about this format:

    Understanding BITSTREAM Data

    1. Encoded Format: The bitstream is essentially a compressed representation of the image or video frame. In your case, it's an MJPEG (Motion JPEG) encoded frame. MJPEG is a sequence of JPEG images, each compressed individually.

    2. Width and Height Values: In the context of a bitstream, width and height do not represent the dimensions of the image. Instead, they reflect internal buffer sizes or other implementation-specific details. Thus, the numbers 3497, 3504, 4892, and 4896 in your output are not indicative of the image dimensions.

    3. Data Length: The length of the bitstream array (len(img) in your code) indicates the size of the compressed data in bytes. This size can vary significantly depending on the content of the frame and the efficiency of the compression. Different sensors or settings (like IMX378 vs. IMX582 in your case) can result in different compression efficiencies, leading to different data lengths for the same resolution.

    4. Decoding Required: To convert this bitstream into a viewable image, you need to decode it using an appropriate decoder that understands the MJPEG format.

    5. Type.BITSTREAM: This is just an enumeration in DepthAI API indicating the type of data contained in the object. In this case, it indicates that the data is a bitstream, not raw image data.

    Additional Notes

    • Variable Size: The size of the encoded data will vary depending on the image's complexity, the amount of motion (in the case of video), and the encoder's settings (like quality level).

    • Usage: Typically, you would send this bitstream to a software or hardware component capable of decoding MJPEG streams to view or process the actual image/video content.

    In summary, the numbers you are seeing are related to the internal handling and size of the encoded data, not the dimensions of the image. To work with the actual image content, you'll need to decode this bitstream using an MJPEG decoder.

    Thanks,
    Jaka