Publishing a stream using librtmp in C/C++

前端 未结 2 1868
情歌与酒
情歌与酒 2021-02-03 13:27

How to publish a stream using librtmp library? I read the librtmp man page and for publishing , RTMP_Write() is used.

I am doing like this.

//Code
//Ini         


        
2条回答
  •  名媛妹妹
    2021-02-03 14:21

    In fact, RTMP_Write() seems to require that you already have the RTMP packet formed in buf.

    RTMPPacket *pkt = &r->m_write;
    ...
    pkt->m_packetType = *buf++;
    

    So, you cannot just push the flv data there - you need to separate it to packets first.

    There is a nice function, RTMP_ReadPacket(), but it reads from the network socket.

    I have the same problem as you, hope to have a solution soon.

    Edit:

    There are certain bugs in RTMP_Write(). I've made a patch and now it works. I'm going to publish that.

提交回复
热议问题