关于gstreamer转发rtsp流的问题

qq_27066319 2018-01-17 05:32:01
我在做一个用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也是一样

请问哪个大神能给我解释下为什么会无法播放
...全文
2912 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sinat_27535821 2019-05-16
  • 打赏
  • 举报
回复
没有设置服务器IP
CyberLogix 2018-04-04
  • 打赏
  • 举报
回复
很显然,RTSP的url有问题,不是IP就是端口有问题,或者是
百灵工作室 2018-01-18
  • 打赏
  • 举报
回复
你确定是8554端口,不是554端口,netstat -tpan 看看你的服务端口是否是正常的
qq_27066319 2018-01-18
  • 打赏
  • 举报
回复
使用gst-launch-1.0.exe运行的时候提示error from element /gstpipeline:pipeline0/gstrtspsrc:rtspsrc0:could not open respurce for reading and writing

2,543

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧