FFMPEG缓冲区下溢

时间:2018-02-28 10:15:36

标签: c++ video ffmpeg screen-capture

我正在录制带有FFMPEG的视频并在此过程中收到一些奇怪的消息

[mpeg @ 01011c80] packet too large, ignoring buffer limits to mux it
[mpeg @ 01011c80] buffer underflow st=0 bufi=236198 size=412405
[mpeg @ 01011c80] buffer underflow st=0 bufi=238239 size=412405

我不知道如何处理它。这是我添加框架的代码

void ofxFFMPEGVideoWriter::addFrame(const uint8_t* pixels)
{
    memcpy(picture_rgb24->data[0], pixels, size);

    sws_scale(swsContext, picture_rgb24->data, picture_rgb24->linesize, 0, codecContext->height, picture->data, picture->linesize);

    AVPacket packet = { 0 };
    int got_packet;
    av_init_packet(&packet);

    int ret = avcodec_encode_video2(codecContext, &packet, picture, &got_packet);
    if (ret < 0) qDebug() << "Error encoding video frame: " << ret;

    if (!ret && got_packet && packet.size)
    {
        packet.stream_index = videoStream->index;
        ret = av_interleaved_write_frame(formatContext, &packet);
    }

    picture->pts += av_rescale_q(1, videoStream->codec->time_base, videoStream->time_base);
}

文件本身似乎很好,并且可读,但这条消息真的让我烦恼。有人知道如何解决它吗?

0 个答案:

没有答案