Skip to content

Commit a823461

Browse files
committed
feat: make loglevel of ffmpeg dependent on buildtype (debug or not)
1 parent b3cd018 commit a823461

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/graphics/video_renderer.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,30 @@ std::vector<std::string> VideoRendererBackend::get_encoding_paramaters(
122122
const std::string framerate = fmt::format("{}", fps);
123123

124124
return {
125-
"-loglevel", "verbose", "-y", "-f", "rawvideo",
126-
"-pix_fmt", "bgra", "-s", resolution, "-r",
127-
framerate, "-i", "-", "-c:v", "libx264",
128-
"-crf", "20", "-pix_fmt", "yuv420p", destination_path.string(),
125+
"-loglevel",
126+
#if !defined(NDEBUG)
127+
"verbose",
128+
#else
129+
"warning",
130+
#endif
131+
"-y", // always overwrite video
132+
"-f",
133+
"rawvideo",
134+
"-pix_fmt",
135+
"bgra",
136+
"-s",
137+
resolution,
138+
"-r",
139+
framerate,
140+
"-i",
141+
"-",
142+
"-c:v",
143+
"libx264",
144+
"-crf",
145+
"20",
146+
"-pix_fmt",
147+
"yuv420p",
148+
destination_path.string(),
129149
};
130150
}
131151

src/graphics/video_renderer_embedded.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ namespace {
7171

7272
ScopeDeferMultiple<void, void*> scope_defer{};
7373

74+
#if !defined(NDEBUG)
7475
// "-loglevel verbose"
7576
av_log_set_level(AV_LOG_VERBOSE);
76-
77+
#else
78+
// "-loglevel warning"
79+
av_log_set_level(AV_LOG_WARNING);
80+
#endif
7781
// input setup
7882

7983
AVFormatContext* input_format_ctx = avformat_alloc_context();
@@ -100,6 +104,7 @@ namespace {
100104
// "-r {framerate}"
101105
av_dict_set(&input_options, "framerate", framerate.c_str(), 0);
102106

107+
// see: https://ffmpeg.org/ffmpeg-protocols.html
103108
std::string input_url = fmt::format("pipe:{}", input_fd);
104109

105110
// "-i pipe:{fd}"

0 commit comments

Comments
 (0)