0

执行此代码:

av_log_set_callback(_log_callback);
av_register_all();
avcodec_register_all();
LOG(avcodec_configuration());
AVOutputFormat * fmt = av_guess_format( "h264", NULL, NULL );

并在我的日志文件中显示下一个配置:

 --target-os=linux --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avfilter --disable-everything --enable-libx264 --enable-encoder=libx264 --enable-decoder=h264 --enable-gpl ....

av_guess_format正在返回 NULL。

有什么建议吗?非常感谢

4

1 回答 1

5

尝试列出所有已注册的编解码器:

AVCodec * codec = NULL;
while(codec = av_codec_next(codec))
{
    LOG(codec->name);
}

UPD

您可以为 H264 创建编码器:

AVCodec * avCodec = avcodec_find_encoder_by_name("h264");
AVCodecContext * avCodecCtx = avcodec_alloc_context3(avCodec);
// fill all required fields in avCodecCtx
AVDictionary * opt = NULL;
avcodec_open2(avCodecCtx, avCodec, &opt);

您没有任何格式,因为您指定了选项--disable-everything

于 2013-05-21T11:27:45.313 回答