我尝试使用最新的Gstreamer 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运行编译后的二进制文件会导致错误:
RTP反加载gstrtpbasedepayload.c:484:gst_rtp_base_depayload_handle_buffer:[00m错误:未协商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 -我不需要手动设置上限。使用GStreamer0.10运行这个管道的部分很有趣。
发布于 2016-06-26 06:17:22
我自己修的。如果你不直接在管道中使用插件,Gstreamer不会抱怨缺少插件。插件的静态注册,udp和rtpmanager解决了这个问题。
https://stackoverflow.com/questions/38007896
复制相似问题