[FFmpeg-devel] why the option 'timeout' in native rtmp plugin doesn't work

qw applemax82 at 163.com
Thu Oct 27 12:18:33 EEST 2016


I want to open and read some rtmp live stream, and don't like wait indefinite time for some rtmp stream when there is no rtmp stream to come. Therefore, the option of 'timeout' is used to set the longest waiting time. But it didn't work, and avformat_open_input() reported as follows:

[rtmp @ 0x1430580] Cannot open connection tcp://localhost:1935?listen&listen_timeout=5000

The source code is shown as follows:

    AVDictionary *pFormatOpts = NULL;
    AVFormatContext *pIfmtCtx;
    char pInRtmpUrl[MAX_RTMP_URL_LENGTH];

    av_dict_set(&pFormatOpts, "rtmp_live", "-1", 0);
    av_dict_set(&pFormatOpts, "rtmp_listen", "1", 0);
    av_dict_set(&pFormatOpts, "timeout", "5", 0);

    avformat_open_input(&pIfmtCtx, pInRtmpUrl, NULL, &pFormatOpts)

Why the rtmp setting doesn't work?

If I want to set the timeout for av_read_frame()/av_interleaved_write_frame() to prevent the function from waiting indefinite time for reading/writing avpackets, is there some options for the native rtmp plugin?




More information about the ffmpeg-devel mailing list