Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.61k stars 545 forks source link

Error when stride is not equal to width #1548

Closed PeterHolik closed 2 years ago

PeterHolik commented 2 years ago

Sorry, your stride patch does not work for my USB Capture Card with an analog camera setting with 512 height 384

v4l2-ctl --get-fmt-video

Format Video Capture: Width/Height : 512/384 Pixel Format : 'YUYV' (YUYV 4:2:2) Field : Interlaced Bytes per Line : 1024 Size Image : 393216 Colorspace : SMPTE 170M Transfer Function : Default (maps to Rec. 709) YCbCr/HSV Encoding: Default (maps to ITU-R 601) Quantization : Default (maps to Limited Range)

v4l2-ctl --list-formats-ext

ioctl: VIDIOC_ENUM_FMT Type: Video Capture

[0]: 'YUYV' (YUYV 4:2:2)
    Size: Stepwise 144x115 - 720x576 with step 1/1
[1]: 'RGBP' (16-bit RGB 5-6-5)
    Size: Stepwise 144x115 - 720x576 with step 1/1
[2]: 'RGGB' (8-bit Bayer RGRG/GBGB)
    Size: Stepwise 144x115 - 720x576 with step 1/1
[3]: 'BA81' (8-bit Bayer BGBG/GRGR)
    Size: Stepwise 144x115 - 720x576 with step 1/1
[4]: 'GRBG' (8-bit Bayer GRGR/BGBG)
    Size: Stepwise 144x115 - 720x576 with step 1/1
[5]: 'GBRG' (8-bit Bayer GBGB/RGRG)
    Size: Stepwise 144x115 - 720x576 with step 1/1
[6]: '411P' (Planar YUV 4:1:1)
    Size: Stepwise 144x115 - 720x576 with step 1/1

Originally posted by @PeterHolik in https://github.com/Motion-Project/motion/issues/1434#issuecomment-1161737319

Mr-Dave commented 2 years ago

Please post the full log at debug level.

PeterHolik commented 2 years ago

Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [ALL] motion_init: Camera 101 started: motion detection Enabled Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] vid_start: Opening V4L2 device Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [ALL] util_parms_parse: Parsing: palette=15,input -1 Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [ALL] util_parms_add: Parsed: >palette< >15< Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [ALL] util_parms_add: Parsed: >input< >-1< Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [ALL] util_parms_add: Parsed: >norm< >0< Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [ALL] util_parms_add: Parsed: >frequency< >0< Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_device_open: Using videodevice /dev/videofront and input -1 Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_device_capability: ------------------------ Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_device_capability: cap.driver: "em28xx" Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_device_capability: cap.card: "Pinnacle Dazzle DVC 90/100/101/" Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_device_capability: cap.bus_info: "usb-0000:00:16.0-1.2" Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_device_capability: cap.capabilities=0x85220001 Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_device_capability: ------------------------ Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_device_capability: - VIDEO_CAPTURE Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_device_capability: - AUDIO Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_device_capability: - READWRITE Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_device_capability: - STREAMING Jun 21 15:28:18 home motion: [1:ml1:front] [DBG] [VID] v4l2_input_select: Name = "Composite", type 0x00000002, status 00000000 Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_input_select: Name = "Composite"- CAMERA Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_norm_select: - video standard PAL Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_norm_select: - video standard PAL-BG Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_norm_select: - video standard PAL-H Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_norm_select: - video standard PAL-I Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_norm_select: - video standard PAL-DK Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_norm_select: Video standard set to PAL Jun 21 15:28:18 home motion: [1:ml1:front] [NTC] [VID] v4l2_pixfmt_try: Testing palette YUYV (512x384) Jun 21 15:28:18 home motion: [1:ml1:front] [WRN] [VID] v4l2_pixfmt_stride: The image width(512) is not equal to the stride(1024) Jun 21 15:28:18 home motion: [1:ml1:front] [WRN] [VID] v4l2_pixfmt_adj: Adjusting resolution from 512x384 to 720x384. Jun 21 15:28:19 home motion: [1:ml1:front] [NTC] [VID] v4l2_pixfmt_set: Using palette YUYV (720x384) Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_fps_set: Trying to set fps to 16 Jun 21 15:28:19 home motion: [1:ml1:front] [ERR] [VID] v4l2_fps_set: Error setting fps. Return code -1 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_fps_set: Device set fps to 16 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ---------Controls--------- Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: V4L2 ID Name and Range Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963776 Brightness, 0 to 255 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963777 Contrast, 0 to 127 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963778 Saturation, 0 to 127 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963779 Hue, -128 to 127 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963781 Volume, 0 to 31 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963785 Mute, 0 to 1 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963790 Red Balance, -48 to 48 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963791 Blue Balance, -48 to 48 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963803 Sharpness, 0 to 15 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963805 Chroma AGC, 0 to 1 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: ID09963812 Chroma Gain, 0 to 127 Jun 21 15:28:19 home motion: [1:ml1:front] [INF] [VID] v4l2_ctrls_list: -------------------------- Jun 21 15:28:19 home motion: [1:ml1:front] [DBG] [VID] v4l2_mmap_request: mmap information: frames=4 Jun 21 15:28:19 home motion: [1:ml1:front] [DBG] [VID] v4l2_mmap_query: 0 length=552960 Address (d35fd000) offset 0 Jun 21 15:28:19 home motion: [1:ml1:front] [DBG] [VID] v4l2_mmap_query: 1 length=552960 Address (d3576000) offset 552960 Jun 21 15:28:19 home motion: [1:ml1:front] [DBG] [VID] v4l2_mmap_query: 2 length=552960 Address (d34ef000) offset 1105920 Jun 21 15:28:19 home motion: [1:ml1:front] [DBG] [VID] v4l2_mmap_query: 3 length=552960 Address (d3468000) offset 1658880 Jun 21 15:28:19 home motion: [1:ml1:front] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items Jun 21 15:28:19 home motion: [1:ml1:front] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 48 item Bildschirmfoto vom 2022-06-21 15-30-33 s

Mr-Dave commented 2 years ago

Thanks for reporting. I'll work on this.

PeterHolik commented 2 years ago

According to v4l2-ctl --list-formats-ext resolution is 144x115 to 720x576

Tried with 720x576 stride is 1440

Jun 21 15:32:50 home motion: [1:ml1:front] [NTC] [VID] v4l2_pixfmt_try: Testing palette YUYV (720x576) Jun 21 15:32:50 home motion: [1:ml1:front] [WRN] [VID] v4l2_pixfmt_stride: The image width(720) is not equal to the stride(1440) Jun 21 15:32:50 home motion: [1:ml1:front] [NTC] [VID] v4l2_pixfmt_set: Using palette YUYV (720x576)

Mr-Dave commented 2 years ago

Let me know if the latest commit (062ebb5a1fdf9acf38cdb35a2f2ae2608363e1ad) does not fix / close this issue.

PeterHolik commented 2 years ago

Works, thanks