Skip to content

Commit 4be8bce

Browse files
author
Clement Champetier
committed
Transcoder: manage FFmpeg log level
* Set it to AV_LOG_QUIET in Transcoder constructor. * Set it to AV_LOG_DEBUG if setVerbose of Transcoder to true.
1 parent d6d9545 commit 4be8bce

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ Transcoder::Transcoder( OutputFile& outputFile )
2222
, _mainStreamIndex( 0 )
2323
, _verbose( false )
2424
{
25+
// Initialize the OutputFile
2526
_outputFile.setup();
27+
28+
// Print no output from ffmpeg
29+
av_log_set_level( AV_LOG_QUIET );
2630
}
2731

2832
Transcoder::~Transcoder()
@@ -285,9 +289,6 @@ void Transcoder::process( IProgress& progress )
285289

286290
_outputFile.beginWrap();
287291

288-
if( _verbose )
289-
av_log_set_level( AV_LOG_DEBUG );
290-
291292
double totalDuration = getTotalDurationFromProcessMethod();
292293

293294
size_t frame = 0;
@@ -325,6 +326,10 @@ void Transcoder::setVerbose( bool verbose )
325326
(*it)->setVerbose( _verbose );
326327
}
327328
_outputFile.setVerbose( _verbose );
329+
330+
// Print stuff which is only useful for ffmpeg developers.
331+
if( _verbose )
332+
av_log_set_level( AV_LOG_DEBUG );
328333
}
329334

330335
void Transcoder::addRewrapStream( const std::string& filename, const size_t streamIndex )

src/AvTranscoder/transcoder/Transcoder.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ enum EProcessMethod
4343
class AvExport Transcoder
4444
{
4545
public:
46+
/**
47+
* @note Set FFmpeg log level to quite.
48+
*/
4649
Transcoder( OutputFile& outputFile );
4750

4851
~Transcoder();
@@ -131,8 +134,9 @@ class AvExport Transcoder
131134
void setProcessMethod( const EProcessMethod eProcessMethod, const size_t indexBasedStream = 0 );
132135

133136
/**
134-
* @brief Set verbose mode for the Transcoder and its streams.
137+
* @brief Set verbose mode for the Transcoder, its streams, and its output file.
135138
* @note If you call it before adding the streams, no verbose mode will be set for the new streams.
139+
* @note set av log level to AV_LOG_DEBUG
136140
*/
137141
void setVerbose( bool verbose = true );
138142

0 commit comments

Comments
 (0)