Skip to content

Unable to Publish raw mjpeg stream directly via compressed image topic #346

@wendwosenbb

Description

@wendwosenbb

@flynneva

I was trying to use the feature you merged in pull request #270, to save on cpu usage by directly publishing via the compressed image topic.
scenarios I tested

  1. I set the pixel_format to raw_mjpeg and av_device_format MJPG (I was expecting this work)
    crashed without any log.
  2. I set the pixel_format to raw_mjpeg and av_device_format YUV422P, I see the green screen

image

    1. I set the pixel_format to mjpeg2rgb and av_device_format YUV422P

this produces compressed image as desired but with significant CPU usage.

would you direct me in how to levarage the feature described in #270. Thank you!

this is my camera_config file:

ros__parameters: video_device: "/dev/windshield_camera" framerate: 15.0 io_method: "mmap" frame_id: "windshield_camera" pixel_format: "raw_mjpeg" av_device_format: "MJPG" #YUV422P, MJPEG image_width: 640 image_height: 480 camera_name: "windshield_camera" camera_info_url: "package://usb_cam/config/camera_info.yaml" brightness: -1 contrast: -1 saturation: -1 sharpness: -1 gain: -1 auto_white_balance: true white_balance: 4000 autoexposure: true exposure: 100 autofocus: false focus: -1

The device formats supports:

`v4l2-ctl --list-formats-ex --device /dev/windshield_camera

ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 1280x720
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 800x600
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)
                    Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 320x240
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)
    [1]: 'YUYV' (YUYV 4:2:2)
            Size: Discrete 1280x720
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 1920x1080
                    Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 800x600
                    Interval: Discrete 0.100s (10.000 fps)
                    Interval: Discrete 0.200s (5.000 fps)
            Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)
            Size: Discrete 320x240
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.040s (25.000 fps)
                    Interval: Discrete 0.050s (20.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Interval: Discrete 0.100s (10.000 fps)`

The usb_cam driver is showing me pixel formats supported

[usb_cam_node_exe-2] This driver supports the following formats:
[usb_cam_node_exe-2] rgb8
[usb_cam_node_exe-2] yuyv
[usb_cam_node_exe-2] yuyv2rgb
[usb_cam_node_exe-2] uyvy
[usb_cam_node_exe-2] uyvy2rgb
[usb_cam_node_exe-2] mono8
[usb_cam_node_exe-2] mono16
[usb_cam_node_exe-2] y102mono8
[usb_cam_node_exe-2] raw_mjpeg
[usb_cam_node_exe-2] mjpeg2rgb
[usb_cam_node_exe-2] m4202rgb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions