Skip to content

FFmpeg:Logging

FFmpeg 로그 출력 설정

static void activex_av_log(const char *fmt, va_list vargs)
{
 char szMsg[512] = {0};
 vsprintf(szMsg, fmt, vargs);
 OutputDebugString("[activex_av_log]");
 OutputDebugString(szMsg);
}

static void av_log_output(void *ptr, int level, const char *fmt, va_list vargs)
{
 KLog log;
 static int print_prefix = 1;
 AVClass *avc = ptr ? *(AVClass**)ptr : NULL;
 if (level > av_log_get_level())
  return;
 if (print_prefix && avc)
  log.WriteFileLog("[%s @ %p]", avc->item_name(ptr), ptr);
 print_prefix = strstr(fmt, "\n") != NULL;
 activex_av_log(fmt, vargs);
 //http_vlog(fmt, vargs);
}

...
int level = av_log_get_level();    // 로그레벨 가져오기
av_log_set_level(99);    // 로그레벨 설정
av_log_set_callback(av_log_output);   // 로그출력 콜백함수 설정

Disable log message

명령행 툴에서는 아래와 같이 사용하면 된다.

$ ffmpeg -loglevel quiet

라이브러리는 av_log계열 함수를 사용하면 된다.

av_log_set_level(AV_LOG_QUIET);

See also

Favorite site