Skip to content

Commit 92df35e

Browse files
committed
Turn off FFmpeg logging entirely
1 parent 6e9267b commit 92df35e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C" {
2020
#include <libavfilter/buffersrc.h>
2121
#include <libavformat/avformat.h>
2222
#include <libavutil/imgutils.h>
23+
#include <libavutil/log.h>
2324
#include <libavutil/pixdesc.h>
2425
#include <libswscale/swscale.h>
2526
}
@@ -69,6 +70,8 @@ std::vector<std::string> splitStringWithDelimiters(
6970

7071
VideoDecoder::VideoDecoder(const std::string& videoFilePath, SeekMode seekMode)
7172
: seekMode_(seekMode) {
73+
av_log_set_level(AV_LOG_QUIET);
74+
7275
AVFormatContext* formatContext = nullptr;
7376
int open_ret = avformat_open_input(
7477
&formatContext, videoFilePath.c_str(), nullptr, nullptr);
@@ -89,6 +92,8 @@ VideoDecoder::VideoDecoder(const void* buffer, size_t length, SeekMode seekMode)
8992
: seekMode_(seekMode) {
9093
TORCH_CHECK(buffer != nullptr, "Video buffer cannot be nullptr!");
9194

95+
av_log_set_level(AV_LOG_QUIET);
96+
9297
AVInput input;
9398
input.formatContext.reset(avformat_alloc_context());
9499
TORCH_CHECK(

0 commit comments

Comments
 (0)