Gstreamer没有RTP

时间:2016-06-24 07:28:38

标签: streaming gstreamer 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:[00米   错误:没有协商RTP格式。

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运行此管道的有趣部分可以正常工作。

1 个答案:

答案 0 :(得分:0)

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