Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs from VideoWriter is not affected by set log level, using OPENCV_LOG_LEVEL #1066

Open
4 tasks done
anitoanto opened this issue Dec 30, 2024 · 4 comments
Open
4 tasks done

Comments

@anitoanto
Copy link

anitoanto commented Dec 30, 2024

Expected behaviour

Setting environment variable OPENCV_LOG_LEVEL=OFF is expected to disable logs from OpenCV.

Actual behaviour

Initializing VideoWriter with fourcc as -1 is producing a list of fourcc.
Update: Setting the fourcc to an incorrect value will also produce error logs irrespective of set log level.

I have read, setting fourcc -1 is expected to list the available fourcc for the format, but what is a potential way to disable this list of fourcc appearing in console?
Any help in disabling those messages is really helpful. Recommendations on setting this log level or disabling the messages from OpenCV on open forums didn't help.

Steps to reproduce

import cv2
out = cv2.VideoWriter("sample.mp4", -1, 30, (400, 400))
import cv2
out = cv2.VideoWriter("sample.mp4", 2, 30, (400, 400))
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python
@l3002
Copy link

l3002 commented Dec 30, 2024

Hi @anitoanto, Could you share environment details in which you are trying to run this program?

@anitoanto
Copy link
Author

Hi @anitoanto, Could you share environment details in which you are trying to run this program?

@l3002 Win 11, Python 3.11.7, opencv-python==4.10.0.84

@AdityaSinghDevs
Copy link

@anitoanto I believe what you are seeing may not be logs but the intentional output from the FFMPEG Backend or OpenCV, fourcc=-1 is used for explicitly listing the available codec,
Since this behavior is intentional, the methods for suppressing logs (such as setting OPENCV_LOG_LEVEL) won't be affecting it. The codec list is generated and displayed as standard output from OpenCV's VideoWriter initialization.

@anitoanto
Copy link
Author

anitoanto commented Dec 30, 2024

@AdityaSinghDevs When the fourcc is set incorrectly, the error message is displayed irrespective of the set log level. Sample code give below.

import cv2
out = cv2.VideoWriter("sample.mp4", 2, 30, (400, 400))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants