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

Node continues to publish last frame after end of video #73

Closed RishabhMalviya closed 3 years ago

RishabhMalviya commented 4 years ago

I'm using this package to stream a video as a stream of frames to a node which manipulates the frames and saves them to disk. I launch the camera.launch from this package in another launch file like this:

<include file="$(find video_stream_opencv)/launch/camera.launch">
    <arg name="camera_name" value="$(arg video_stream_topic_name)"/>
    <arg name="video_stream_provider" value="$(arg video_file)"/>
    <arg name="stop_frame" value="-1"/>
</include>

Once the video is finished (~1000 frames), it continues to publish the last frame indefinitely, while throwing the following error on console:

[ERROR] [1590444387.369692670]: Could not capture frame
[ERROR] [1590444387.402886483]: Could not capture frame
[ERROR] [1590444387.436512947]: Could not capture frame
[ERROR] [1590444387.470821575]: Could not capture frame
[ERROR] [1590444387.504174047]: Could not capture frame
awesomebytes commented 3 years ago

This PR fixes it: https://github.com/ros-drivers/video_stream_opencv/pull/97

That said, I'd like a review from someone else to make sure I didn't miss anything. I don't want to break a behavior that maybe someone depends on.