关于gstreamer转发rtsp流的问题

qq_27066319 qq_27066319 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在做一个用gstreamer转发rtsp流的项目,现在还在摸索阶段。用官方提供的例子

int
main (int argc, char *argv[])
{
GMainLoop *loop;
GstRTSPServer *server;
GstRTSPMountPoints *mounts;
GstRTSPMediaFactory *factory;
gchar *str;

gst_init (&argc, &argv);



loop = g_main_loop_new (NULL, FALSE);

/* create a server instance */
server = gst_rtsp_server_new ();

/* get the mount points for this server, every server has a default object
* that be used to map uri mount points to media factories */
mounts = gst_rtsp_server_get_mount_points (server);

str = g_strdup_printf ("( "
"filesrc location=C:/Users/Administrator/Desktop/test.mp4 ! qtdemux name=d "
"d. ! queue ! rtph264pay pt=96 name=pay0 "
"d. ! queue ! rtpmp4apay pt=97 name=pay1 " ")");


/* make a media factory for a test stream. The default media factory can use
* gst-launch syntax to create pipelines.
* any launch line works as long as it contains elements named pay%d. Each
* element with pay%d names will be a stream */
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory, str);
g_free (str);

/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);

/* don't need the ref to the mapper anymore */
g_object_unref (mounts);

/* attach the server to the default maincontext */
gst_rtsp_server_attach (server, NULL);

/* start serving */
g_main_loop_run (loop);

return 0;
}
使用vlc通过网络播放,总是提示

您的输入无法被打开:
VLC 无法打开 MRL「rtsp://172.16.35.82:8554/test」。详情请检查日志。
用127.0.0.1:8554也是一样

请问哪个大神能给我解释下为什么会无法播放
...全文
评论 4
收藏 已收藏
分享
返回顶部