Opened 7 years ago

Last modified 5 years ago

#6522 new enhancement

Hardcoded publish type of rtmp publishing

Reported by: blackshadow4279 Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: rtmp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Type of publishing in RTMP spec:
"live", "record", or "append".
record: The stream is published and the data is recorded to a new file.The file is stored on the server in a subdirectory within the directory that contains the server application. If the file already exists, it is overwritten.
append: The stream is published and the data is appended to a file. If no file is found, it is created.
live: Live data is published without
recording it in a file.

In we have hardcoded type "live":

static int gen_publish(URLContext *s, RTMPContext *rt)
    RTMPPacket pkt;
    uint8_t *p;
    int ret;

    av_log(s, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath);

    if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE,
                                     0, 30 + strlen(rt->playpath))) < 0)
        return ret;

    pkt.extra = rt->stream_id;

    p =;
    ff_amf_write_string(&p, "publish");
    ff_amf_write_number(&p, ++rt->nb_invokes);
    ff_amf_write_string(&p, rt->playpath);
    ff_amf_write_string(&p, "live");

    return rtmp_send_packet(rt, &pkt, 1);

For myself, of course, I will recompile, but I hope that it will be useful to someone.

Change History (1)

comment:1 by Carl Eugen Hoyos, 5 years ago

Analyzed by developer: unset
Keywords: streaming publish type removed
Priority: normalwish
Reproduced by developer: unset

If you have a patch, please send it - made with git format-patch - to the FFmpeg development mailing list, patches are ignored on this bug tracker.

Note: See TracTickets for help on using tickets.