Crash error avformat_open_input

I am trying to open a file with avformat_open_input

and it will work even if the file exists.

av_register_all();

AVFormatContext *avFormatContext;

if (avformat_open_input(&avFormatContext, argv[1], NULL, NULL) < 0)
{
    av_log(0, AV_LOG_FATAL, "Wasn't possible opening the file: %s", argv[1]);
    return -1;
}

      

+3


source to share


1 answer


First, you must NULL for the avFormatContext variable:



av_register_all();

AVFormatContext *avFormatContext = NULL;

if (avformat_open_input(&avFormatContext, argv[1], NULL, NULL) < 0)
{
    av_log(0, AV_LOG_FATAL, "Wasn't possible opening the file: %s", argv[1]);
    return -1;
}

      

+5


source







All Articles