我正在尝试使用 avformat_open_input
打开一个文件,即使该文件存在它也会崩溃。
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;
}
最佳答案
您必须先将 avFormatContext 变量设为 NULL:
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;
}
关于c++ - avformat_open_input 函数崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26552897/