ChenLittlePing/LearningVideo

最后一节的FFmpeg 视频编码问题

FrankyLee-dev opened this issue · 3 comments

这里打印无法打开encoder的log

void BaseEncoder::OpenEncoder() {
    InitContext(m_codec_ctx);

    int ret = avcodec_open2(m_codec_ctx, m_codec, NULL);
    if (ret < 0) {
        LOG_ERROR(TAG, LogSpec(), "Fail to open encoder : %d", m_codec);
        return;
    }

    m_encode_stream_index = ConfigureMuxerStream(m_muxer, m_codec_ctx);
}

log如下:

BaseEncoder: [视频] Fail to open encoder : -2137540360
BaseEncoder: [音频] Send frame error[EINVAL]: Invalid argument
BaseEncoder: [视频] Send frame error[EINVAL]: Invalid argument
BaseEncoder: [视频] Encode error[EINVAL]: Invalid argument

请问这个错误怎么解决呢?