[Libav-user] One question about timeout in rtmp

qw applemax82 at 163.com
Wed Jul 20 11:57:51 CEST 2016


I use native rtmp in ffmpeg 3.1.1 to demuxer rtmp stream from nginx server. avformat_open_input() is used to open input rtmp stream. Native rtmp plugin supports 'timeout' option as shown below:

  -timeout           <int>        .D...... Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies -rtmp_listen 1 (from INT_MIN to INT_MAX) (default -1)

I add timeout of 10 seconds to rtmp option set, and call avformat_open_input().

    AVDictionary *format_opts = NULL;
    av_dict_set(&format_opts, "timeout", "10", 0);
    avformat_open_input(fmt-ctx, rtmp-url, NULL, &format_opts);

But avformat_open_input() will return immediately with error messages as follows:

[rtmp @ 0x8ff9a0] Cannot open connection tcp://localhost:1935?listen&listen_timeout=10000
Cannot open input rtmp url:
Fail to call openInputLiveStream()!

nginx server didn't provide live streaming service. It was expected that avformat_open_input() would return in 10 seconds with error mesage. But why did the function return immediately?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160720/0304d227/attachment.html>

More information about the Libav-user mailing list