c++ – How to check if FFMpeg avformat_open_input was interrupted by timeout?


AVDictionary *opts = NULL;
AVFormatContext *ctx = NULL;

av_dict_set(&opts, "stimeout", std::to_string(mStartingTTLInSec * 1000000).c_str(), 0);

int ret = avformat_open_input(&ctx, szFilePath, NULL, &opts);

My code is working, I just want to know the error code to check if avformat_open_input was failed because of “stimeout”.

I see FFMpeg log in console

(tcp @ 0x55bc74f20080) Connection to tcp://91.185.5.146:22692?timeout=4000000 failed: Connection timed out

But I need to react to it in code.