2013-05-21 38 views
0

執行此代碼返回NULL:av_guess_format H264在Android

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。

有什麼建議嗎? 非常感謝

回答

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

+0

列出了h264,vp8,libvpx,libx264。 –

+0

對不起,在我看來你正在創建一個編碼器。你想爲RAW H264創建一個容器? – pogorskiy

+0

我使用h264編碼視頻。在Windows上ffmpeg + h264工作正常,然後我想在android上運行相同的應用程序。 –