今天,当我在CodeBlocks中运行ffmpeg示例c程序时,我得到了错误:
invalid conversion from int to avcodecid[-fpermissive]我把代码的一部分放在这里:
static AVCodec **codec;
static AVCodecContext *c= NULL;
static int ret, got_output;
static FILE *f;
static AVFrame *frame;
static AVPacket pkt;
static uint8_t endcode[] = { 0, 0, 1, 0xb7 };
enum AVCodecID codec_id;
*codec = avcodec_find_encoder(codec_id);无论我使用*codec还是codec,它都会产生同样的错误,我检查了我的opencv和ffmpeg版本,所有最新版本都是2.4.10 opencv和2.5.3ffmpeg。如果我单击错误,它会将我指向另一个文件avcode.h,给出错误
初始化“AVcodec*acvodec_find_encoder(AVCodeciD)”的第1标记-允许的
在文件的这一行
frame = avcodec_alloc_frame();发布于 2015-03-18 07:23:30
此错误消息
从int到avco发允许的无效转换
意味着不存在从int到enum AVCodecID类型的隐式转换。因此,您需要显式地将整数强制转换为枚举的类型。
我想你包括了所有必需的标题,不是吗?
此错误消息
初始化“AVcodec*acvodec_find_encoder(AVCodeciD)”的第1标记-允许的
表示函数调用使用了错误的参数类型。您必须在调用函数声明之前检查它,并为其参数提供正确的参数。
https://stackoverflow.com/questions/29115929
复制相似问题