Allow to set av_log_set_level to reduce ffmpeg level below AV_LOG_ERROR#20897
Allow to set av_log_set_level to reduce ffmpeg level below AV_LOG_ERROR#20897opencv-pushbot merged 1 commit intoopencv:3.4from
Conversation
| av_log_set_level(atoi(level_option)); | ||
| } | ||
|
|
||
| char* debug_option = getenv("OPENCV_FFMPEG_DEBUG"); |
There was a problem hiding this comment.
There is already OPENCV_FFMPEG_DEBUG option to "reduce de ffmpeg loglevel below ERROR".
Please note, that this is global configuration of FFmpeg, it is not about OpenCV calls only (other libraries may be affected, e.g., gst-libav plugin).
Added code doesn't work at all as expected (av_log_set_level() is called with own values below anyway)
There was a problem hiding this comment.
Hi Alexander,
The environment variable OPENCV_FFMPEG_DEBUG, only allow to set verbose, moreover as the fucntion ffmpeg_log_callback doesnot check the log level, it prints all levels.
Impacting all usage of ffmeg is the situation I would like to manage, printing thousand of errors decoding SEI frames or bad H264 code coming from a camera doesnot helps of maintenance.
I will improve the situation when OPENCV_FFMPEG_DEBUG and OPENCV_FFMPEG_LOGLEVEL are both defined.
My first idea was to extend the feature of OPENCV_FFMPEG_DEBUG, interpretaing the value of the variable as a loglevel, for me this is fine. But setting OPENCV_FFMPEG_DEBUG change the log callback and all levels are printed, and this is not what I would like.
If you prefer this way (setting level in the existing variable OPENCV_FFMPEG_DEBUG, and filtering the level active in the callback, I prefer and can update the PR in this way.
Best Regards,
Michel.
|
Hi, I updated the PR in order to filter log of non active level setting Best Regards, |
alalek
left a comment
There was a problem hiding this comment.
Looks good to me!
This patch should go into 3.4 branch first.
We will merge changes from 3.4 into master regularly (weekly/bi-weekly).
Please:
- change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
- rebase your commits from master onto 3.4 branch. For example:
git rebase -i --onto upstream/3.4 upstream/master
(check list of your commits, save and quit (Esc + "wq" + Enter)
whereupstreamis configured by following this GitHub guide and fetched (git fetch upstream). - push rebased commits into source branch of your fork (with
--forceoption)
Note: no needs to re-open PR, apply changes "inplace".
02b3096 to
9a9e457
Compare
Hi,
I submit this PR in order to allow to reduce de ffmpeg loglevel below ERROR (that is 32).
During H264 decoding it is quite often ffmpeg print lots of error log (like bad SEI parsing) that may not be relevant in production.
This PR allow to set the ffmpeg level through the environment variable
OPENCV_FFMPEG_LOGLEVELBest Regards,
Michel.
Patch to opencv_extra has the same branch name.