How do I make FFmpeg C++ code not output error messages?

Viewed 690

I'm decoding video using FFmpeg's C++ library like this:

AVPacket* avPacket = av_packet_alloc();
if (!avPacket) std::cout << "av packet error" << std::endl;
int result = avcodec_send_packet(avCodecContext, avPacket);
    if (!result) {
        for ( ; !result ; ) {
            result = avcodec_receive_frame(avCodecContext, avFrame);
            if (!result) {
            ...

It works, but sometimes FFmpeg encounters problematic frames and emits the following:

[h264 @ 0x7fd3bc2c4b00] no frame!
[h264 @ 0x7fd3bc2c4b00] no frame!
[h264 @ 0x7fd3bc2c4b00] no frame!

Is it possible to turn off these messages? I don't see any obvious way to do it.

2 Answers

In my code, I use av_log_set_callback() to redirect output messages to my own log file, so I can filter out unwanted messages before writing them to the log.

Related