Gstreamer 无 RTP

Gstreamer No RTP

我尝试使用最新的 Gstreamer Libs 1.8.0 编译静态二进制文件。我想获取传入的 RTSP 流并将其放入文件中。管道是:

rtspsrc location=rtsp://X.X.X.X/ protocols=GST_RTSP_LOWER_TRANS_TCP ! queue ! rtph264depay ! h264parse ! flvmux  name=\"mux\" streamable=\"true\" ! fakesink

运行 编译二进制结果出错:

rtpbasedepayload gstrtpbasedepayload.c:484:gst_rtp_base_depayload_handle_buffer:[00m error: No RTP format was negotiated.

int main(int argc, char *argv[]) {
  GstElement *pipeline;
  GstBus *bus;
  GstStateChangeReturn ret;
  GMainLoop *main_loop;
  CustomData data;

  /* Initialize GStreamer */
  gst_init (&argc, &argv);
   registerGstStaticPlugins();

  /* Initialize our data structure */
  memset (&data, 0, sizeof (data));

  /* Build the pipeline */

  pipeline = gst_parse_launch ("rtspsrc location=rtsp://X.X.X.X/ protocols=GST_RTSP_LOWER_TRANS_TCP ! queue ! rtph264depay ! h264parse ! flvmux  name=\"mux\" streamable=\"true\" ! fakesink", NULL);

  bus = gst_element_get_bus (pipeline);

  /* Start playing */
  ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
  if (ret == GST_STATE_CHANGE_FAILURE) {
    g_printerr ("Unable to set the pipeline to the playing state.\n");
    gst_object_unref (pipeline);
    return -1;
  } else if (ret == GST_STATE_CHANGE_NO_PREROLL) {
    data.is_live = TRUE;
  }

  main_loop = g_main_loop_new (NULL, FALSE);
  data.loop = main_loop;
  data.pipeline = pipeline;

  gst_bus_add_signal_watch (bus);
  g_signal_connect (bus, "message", G_CALLBACK (cb_message), &data);

  g_main_loop_run (main_loop);

  /* Free resources */
  g_main_loop_unref (main_loop);
  gst_object_unref (bus);
  gst_element_set_state (pipeline, GST_STATE_NULL);
  gst_object_unref (pipeline);
  return 0;
}

完整输出:http://pastebin.com/Ln06d0iP

由于源是带有 SDP 数据的 RTSP - 我不需要手动设置上限。有趣的是 运行 这个使用 Gstreamer 0.10 的管道工作正常。

我自己修的。如果您不直接在管道中使用它们,Gstreamer 不会抱怨缺少插件。插件udp和rtpmanager的静态注册解决了这个问题。