I am trying to start a video stream based on G-streamer in the Opencv library:
cv::VideoWriter writer("", cv::CAP_GSTREAMER, 0, 30.0, cv::Size(640, 480), true);
writer = std::make_shared<cv::VideoWriter>("appsrc ! videoconvert !\
videoscale ! video/x-raw,width=640,height=480 ! vaapih264enc !\
rtspclientsink location=rtsp://localhost:8554/mystream",
cv::CAP_GSTREAMER, 0, 30.0, cv::Size(640, 480), true);
I am able to build my ROS2 library fine with colcon build.
but when i try to launch my script and it gets to the line where i reassign the writer, i get the following error:
> ros2 run camera_handler SDK_camera_api
[ WARN:0 ] global ./modules/videoio/src/cap_gstreamer.cpp (1673) open OpenCV | GStreamer warning: error opening writer pipeline: no element "vaapih264enc"
SDK-camera-api starting, wait for started message
Remote SDK version: 1.5.00
Initiating camera:
Working directory: "/home/ubuntu/Larke/drone_controller"
Remote SDK successfully initialized.
Enumerating connected camera devices:
\*\*SDK_camera_api: ../../libusb/core.c:1170: libusb_ref_device: Assertion \`refcnt \>= 2' failed.
\*\*
I have tried so many things but the same error seems to pop up, and i got no clue to what it is, i guess it is some kind of refecence counting?
Thank you so much in advance
I tried both outside of the ROS2 class, inside a ROS2 class, and declare the writer beforehand.
EDIT:
I just noticed the warning about no vaapih264enc, unfortunately this is not the only problem, since i've tried where i do not get this warning, so it might be another problem.