NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Logitech HD Pro Webcam C920 USB webcam resolution



On 2/25/2025 11:06, Ramiro Aceves wrote:
Hello,
I am having trouble to get proper pictures and videos from it.

with:

$ffmpeg7 -f v4l2 -i /dev/video0 -vframes 1 output.jpg

I get a very dark picture.

with:

ffmpeg7 -f v4l2 -i /dev/video0 -vframes 5  output_%02d.jpg


Not sure if this helps, but I've had issues using OpenCV as well. It seems there's an issue with an ioctl call when changing camera settings. In my case, I can't use OpenCV to change the resolution from the default.

I ended up making a couple changes for my camera as a workaround to at least get full resolution.

Also, I have to "warm" the camera auto brightness before taking a final image.

Here's my OpenCV git diff:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa409f516c..c05da68e82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,10 @@
 #
# ----------------------------------------------------------------------------

+# BSD
+add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=gnu17>)
+add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=gnu++20>)
+
 # Disable in-source builds to prevent source tree corruption.
 if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
   message(FATAL_ERROR "
@@ -129,7 +133,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # https://cmake.org/cmake/help/
     if(WIN32)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
     else()
- set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory" FORCE) + set(CMAKE_INSTALL_PREFIX "/usr/pkg" CACHE PATH "Installation Directory" FORCE)
     endif()
   else()
     # any cross-compiling
diff --git a/modules/videoio/src/cap_v4l.cpp b/modules/videoio/src/cap_v4l.cpp
index 2fc41ce05e..2af652597d 100644
--- a/modules/videoio/src/cap_v4l.cpp
+++ b/modules/videoio/src/cap_v4l.cpp
@@ -222,6 +222,14 @@ make & enjoy!
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
+#include <inttypes.h>
+#include <stdint.h>
+#ifndef __u32
+#define __u32 uint32_t
+#endif
+#ifndef __s32
+#define __s32 int32_t
+#endif
 #include <limits>

 #include <poll.h>
@@ -276,8 +284,8 @@ typedef uint32_t __u32;
 #endif

/* Defaults - If your board can do better, set it here. Set for the most common type inputs. */
-#define DEFAULT_V4L_WIDTH  640
-#define DEFAULT_V4L_HEIGHT 480
+#define DEFAULT_V4L_WIDTH  1280
+#define DEFAULT_V4L_HEIGHT 720
 #define DEFAULT_V4L_FPS 30


Home | Main Index | Thread Index | Old Index