0

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.

Christian Fritz
  • 20,641
  • 3
  • 42
  • 71
  • What's the reason for reassigning the wtiter? Why dont you use your desired writer directly? Are you able the sane gstreamer pipeline by gst-launch? – Micka Jul 10 '23 at 11:57
  • I have tried that, and not got any helpful result. The same pipeline is able to run outside of the ROS2 environment unfortunately. – Chris Mikkelsen Jul 10 '23 at 12:15

0 Answers0