av_guess_format h264在Android上返回NULL

Mig*_*gel 0 android ffmpeg h.264

执行此代码:

av_log_set_callback(_log_callback);
av_register_all();
avcodec_register_all();
LOG(avcodec_configuration());
AVOutputFormat * fmt = av_guess_format( "h264", NULL, NULL );
Run Code Online (Sandbox Code Playgroud)

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

 --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 ....
Run Code Online (Sandbox Code Playgroud)

av_guess_format 正在返回NULL.

有什么建议吗?非常感谢

pog*_*kiy 5

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

AVCodec * codec = NULL;
while(codec = av_codec_next(codec))
{
    LOG(codec->name);
}
Run Code Online (Sandbox Code Playgroud)

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);
Run Code Online (Sandbox Code Playgroud)

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