Hi,
How to publish a stream using librtmp library?
I read the librtmp man page and for publishing , RTMP_Write() is used.
I am using C/C++ for my application.
//Code
//Init RTMP code
RTMP *r;
char uri[]="rtmp://localhost:1935/live/desktop";
r= RTMP_Alloc();
RTMP_Init(r);
RTMP_SetupURL(r, (char*)uri);
RTMP_EnableWrite(r); // To publish a stream, enable write support before connect
RTMP_Connect(r, NULL);
RTMP_ConnectStream(r,0);
Then to respond to ping/other messages from server, I am using a thread to respond like following:
//Thread
While (ThreadIsRunning && RTMP_IsConnected(r) && RTMP_ReadPacket(r, &packet))
{
if (RTMPPacket_IsReady(&packet))
{
if (!packet.m_nBodySize)
continue;
RTMP_ClientPacket(r, &packet); //This takes care of handling ping/other messages
RTMPPacket_Free(&packet);
}
}I am stuck at how to use RTMP_Write() to send the stream.
Please help me.Thanks,
Dhruva
Using librtmp library to publish a live stream to Wowza Media Server
最新推荐文章于 2025-02-23 19:06:43 发布
本文探讨了如何使用librtmp库通过C/C++应用发布流媒体。文章详细介绍了初始化RTMP连接的过程,并提到了如何响应服务器消息,但作者在使用RTMP_Write()发送流时遇到了困难。
1062

被折叠的 条评论
为什么被折叠?



