ros-drivers / gscam

ROS Camera driver for GStreamer-based video streams.
142 stars 174 forks source link

Decklink gstreamer 1.0 ubuntu 16.04 ros kinetic #42

Open anfontanelli opened 6 years ago

anfontanelli commented 6 years ago

The Gstreamer and the plugin-bad (version 1.0) has been installed via apt-get install. The output of gst-inspect-1.0 decklinkvideosrc is correct where a set of valid modes are printed.

The Gscam is compiled with GSTREAMER_VERSION_1_x=TRUE (i.e. gstreamer 1.0) without any error. The decklink.launch file has been modified accordingly:

<launch>
  <!-- This launchfile should bring up a node that broadcasts a ros image
       transport on /decklink/image_raw from the input channel of a BlackMagic
       DeckLink SDI capture card-->

  <!-- DeckLink config, run $ gst-inspect decklinksrc to see all the options for your card -->
  <arg name="MODE" default="pal"/>
  <arg name="CONNECTION" default="sdi"/>
  <arg name="SUBDEVICE" default="0"/>
  <arg name="PUBLISH_FRAME" default="false"/>

  <node ns="decklink" name="gscam_driver_decklink" pkg="gscam" type="gscam" output="screen">
    <param name="camera_name" value="default"/>
    <param name="camera_info_url" value="package://gscam/examples/uncalibrated_parameters.ini"/>
    <param name="gscam_config" value="**decklinkvideosrc** mode=$(arg MODE) connection=$(arg CONNECTION) subdevice=$(arg SUBDEVICE) ! ffmpegcolorspace "/>
    <param name="frame_id" value="/decklink_frame"/>
    <!-- This needs to be set to false to avoid dropping tons of frames -->
    <param name="sync_sink" value="false"/>
  </node>

  <node name="decklink_transform" pkg="tf" type="static_transform_publisher" args="1 2 3 0 -3.141 0 /world /decklink_frame 10"/>
</launch>

When doing roslaunch gscam decklink.launch, following error shown up:

process[decklink/gscam_driver_decklink-1]: started with pid [31450] [ INFO] [1516390751.641571150]: Using gstreamer config from rosparam: "decklinkvideosrc mode=pal connection=sdi subdevice=0 ! ffmpegcolorspace" [ INFO] [1516390751.645708444]: camera calibration URL: package://gscam/examples/uncalibrated_parameters.ini [ INFO] [1516390751.645928707]: Loaded camera calibration from package://gscam/examples/uncalibrated_parameters.ini [FATAL] [1516390751.658352781]: GStreamer: cannot link launchpipe -> sink [FATAL] [1516390751.658481388]: Failed to initialize gscam stream! WARNING: Catkin package name "suturePlanner_msgs" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, and underscores. process[decklink_transform-2]: started with pid [31472] [decklink/gscam_driver_decklink-1] process has finished cleanly

Would you please suggest what might be the problem?

adeguet1 commented 6 years ago

I ran into a similar problem and was able to get something working. I'm not totally sure I have the best gscam_config but at least I'm getting some images. The issue seems to be the options passed to the decklink plugin and the gstreamer pipe.

For the options, I now have: device-number=0. I skipped the mode and connection, the defaults work for me.

For the pipeline, I used videoconvert. I'm not sure this is the best option, there might be a more efficient filter to use. The overall gscam_config is: decklinkvideosrc connection=sdi device-number=1 ! videoconvert

I left some notes on github for our dVRK community: https://github.com/jhu-dvrk/dvrk-ros/blob/devel/dvrk_robot/video.md

I hope this helps.