ros-drivers / video_stream_opencv

A package to open video streams and publish them in ROS using the opencv videocapture mechanism
224 stars 159 forks source link

'Could not capture frame' error when 'stop_frame' is -1 #72

Closed hoonkai closed 3 years ago

hoonkai commented 4 years ago

Hi

When stop_frame is set to -1, capturing the stream leads to the following error:

[ERROR] [1589731616.096380328]: Could not capture frame
[ERROR] [1589731616.129171038]: Could not capture frame
[ERROR] [1589731616.162531012]: Could not capture frame
[ERROR] [1589731616.195890605]: Could not capture frame
[ERROR] [1589731616.229178206]: Could not capture frame

as I briefly reported here: https://github.com/ros-perception/image_pipeline/issues/516#issuecomment-629823085_

Here's the result of a quick investigation. This line handles the case when stop_frame == -1: https://github.com/ros-drivers/video_stream_opencv/blob/master/src/video_stream.cpp#L244

where latest_config is a copy of config. But https://github.com/ros-drivers/video_stream_opencv/blob/master/src/video_stream.cpp#L140 expects a meaningful value of stop_frame.

I've managed to avoid the error by making latest_config a VideoStreamConfig*, but I'm not sure if that'll produce unintended effects.

furushchev commented 3 years ago

@hoonkai Sorry for delay. Could you please check if https://github.com/ros-drivers/video_stream_opencv/issues/72 fixes the issue?

lchop commented 3 years ago

Hello ! I have the same issue, when could not capture frame error is raise, the node is not able to publish again the image. I have to kill the node and re launch it. Do you have the same issue ?

awesomebytes commented 3 years ago

I believe the parameter reopen_on_read_failure should allow to fix this, but I'm not sure if this is the same issue. I'll close for now, reopen if you think it's still an issue.