Webrtc Android Ffmpeg软解报错 H264解码找不到
Webrtc Android Ffmpeg软解报错 H264解码找不到
报错:
1
2
3
4
5
6
7
8
9
const AVCodec* codec = avcodec_find_decoder(av_context_->codec_id);
if (!codec) {
// This is an indication that FFmpeg has not been initialized or it has not
// been compiled/initialized with the correct set of codecs.
RTC_LOG(LS_ERROR) << "FFmpeg H.264 decoder not found.";
Release();
ReportError();
return false;
}
增加编译参数 rtc_use_h264=true 不管用!
修改 ffmpeg_generated.gni
找到third_party/ffmpeg/ffmpeg_generated.gni
use_linux_config,添加 || is_android以支持,结果如下
use_linux_config = is_linux || is_fuchsia || is_android
增加 codec_list parser_list h264 支持
修改 arm64
, 相应的armv7的改相应目录即可
1
2
3
chromium/config/Chrome/android/arm64/config.h 中 CONFIG_H264_DECODER 设置为 1
third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavcodec/parser_list.c 添加 &ff_h264_parser,
third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavcodec/codec_list.c 添加 &ff_h264_decoder,
编译参数添加 rtc_use_h264=true ffmpeg_branding="Chrome"
本文由作者按照 CC BY 4.0 进行授权