[FFmpeg-user] how to set timeout for opening or reading rtmp stream

qw applemax82 at 163.com
Wed Nov 2 05:37:24 EET 2016


Hi lou,


In fact, I use ffmpeg lib to make new application that can do av transcoding. The application reads one rtmp stream, transcodes av stream and write to another rtmp stream.


Part of source code is shown as follows:


    pAVInFmt = av_find_input_format("live_flv");
    pFmtCtx = avformat_alloc_context();


    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(&pFmtCtx, pFilename, pAVInFmt, NULL);


I have set the timeout to 5 seconds, which means avformat_open_input() will wait 5 seconds for the incoming rtmp stream. But indeed the application is always waiting and doesn't stop.


I think there is some command arguments that correspond to the usage of calling ffmpeg functions directly. But I don't use ffmpeg command to do the transcoding of rtmp stream.

Thanks!




At 2016-11-02 01:34:37, "Lou" <lou at lrcd.com> wrote:
>On Tue, 1 Nov 2016 13:08:40 +0800 (CST)
>qw  <applemax82 at 163.com> wrote:
>
>> Thanks for your reply. But it doesn't work.
>
>"doesn't work" is too vague to provide any helpful suggestions.
>
>What command did you use?
>
>What did the complete console output show?
>
>How can we duplicate the issue?
>_______________________________________________
>ffmpeg-user mailing list
>ffmpeg-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>To unsubscribe, visit link above, or email
>ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list