[FFmpeg-devel] Detecting EOF in RTMP

TalkVideo at TalkVideo.net TalkVideo at TalkVideo.net
Wed Jan 30 00:36:16 EET 2019

This is from an old thread here:


The problem at hand manifests itself as "freeze-frame" of the last frame in
a stream being displayed in OBS, until that source is de-activated and re-activated.

It seems that:

mp_media_next_packet() (from OBS)

 int ret = av_read_frame(media->fmt, &pkt);

which waits for the next frame that never comes when the
remote device stops sending RTMP data.

So the question becomes, if one is developing an App to send an RTMP
Stream, is sending an EOT Control Character (Ascii \004) the way to signal the eof?

I looked at:

01523                 if (eof && next_pkt->pts == AV_NOPTS_VALUE && last_dts != AV_NOPTS_VALUE)

I have not tried this yet with just using a file as the source in OBS, but as
far as I can see, the calls to av_read_frame will return a value on eof that can
be hanled by the calling program.


More information about the ffmpeg-devel mailing list