Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
4
votes
1
answers
5264
views
How to record v4l webcam with ffmpeg? Cannot find a proper format for codec 'none'
Goal is to capture video from my old usb webcam (device 0733:0430). Trying to save video gives this error. (I've tried both ffmpeg and avconv.) Command `ffmpeg -f v4l2 -i /dev/video2 -s 160x120 tmp.mkv` [video4linux2,v4l2 @ 0x815280] Time per frame unknown [video4linux2,v4l2 @ 0x815280] Cannot find...
Goal is to capture video from my old usb webcam (device 0733:0430). Trying to save video gives this error. (I've tried both ffmpeg and avconv.)
Command
ffmpeg -f v4l2 -i /dev/video2 -s 160x120 tmp.mkv
[video4linux2,v4l2 @ 0x815280] Time per frame unknown
[video4linux2,v4l2 @ 0x815280] Cannot find a proper format for codec 'none' (id 0), pixel format 'none' (id -1)
Assertion *codec_id != AV_CODEC_ID_NONE failed at /build/buildd/ffmpeg-2.3/libavdevice/v4l2.c:802
I know it can work on Linux, because I had it running a few years ago. How to get it to work now?
----
**Below is information about the device.**
Device dmesg output
[53008.270283] usb 2-1.2: new full-speed USB device number 4 using ehci-pci
[53008.363405] usb 2-1.2: New USB device found, idVendor=0733, idProduct=0430
[53008.363416] usb 2-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[53008.779745] gspca_main: v2.14.0 registered
[53008.809496] gspca_main: spca505-2.14.0 probing 0733:0430
[53008.812508] usbcore: registered new interface driver spca505
ffmpeg -list_formats 1 -f v4l2 -i /dev/video2
[video4linux2,v4l2 @ 0xbed5e0] Raw : Unsupported : S505 : 160x120 176x144 320x240 352x288
v4l-info /dev/video2
### v4l2 device info [/dev/video2] ###
general info
VIDIOC_QUERYCAP
driver : "spca505"
card : "USB Camera (0733:0430)"
bus_info : "usb-0000:00:1d.0-1.2"
version : 3.13.11
capabilities : 0x85000001 [VIDEO_CAPTURE,READWRITE,STREAMING,(null)]
standards
inputs
VIDIOC_ENUMINPUT(0)
index : 0
name : "spca505"
type : CAMERA
audioset : 0
tuner : 0
std : 0x0 []
status : 0x0 []
video capture
VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
index : 0
type : VIDEO_CAPTURE
flags : 0
description : "S505"
pixelformat : 0x35303553 [S505]
VIDIOC_G_FMT(VIDEO_CAPTURE)
type : VIDEO_CAPTURE
fmt.pix.width : 160
fmt.pix.height : 120
fmt.pix.pixelformat : 0x35303553 [S505]
fmt.pix.field : NONE
fmt.pix.bytesperline : 160
fmt.pix.sizeimage : 28800
fmt.pix.colorspace : SRGB
fmt.pix.priv : 0
controls
VIDIOC_QUERYCTRL(BASE+0)
id : 9963776
type : INTEGER
name : "Brightness"
minimum : 0
maximum : 255
step : 1
default_value : 127
flags : 32
Rucent88
(1910 rep)
Aug 9, 2014, 12:02 PM
• Last activity: Aug 3, 2025, 10:10 PM
3
votes
1
answers
2677
views
how to use ipu3-cio camera in linux
I have a Thinkpad X1 Tablet (gen 2) with a front and back integrated camera running Ubuntu 19:10. The cameras appear to be detected: > $ v4l-info > > ### v4l2 device info [/dev/video0] ### > general info > VIDIOC_QUERYCAP > driver : "ipu3-cio2" > card : "Intel > IPU3 CIO2" bus_info : "PCI:0000:00:14...
I have a Thinkpad X1 Tablet (gen 2) with a front and back integrated camera running Ubuntu 19:10. The cameras appear to be detected:
> $ v4l-info
>
> ### v4l2 device info [/dev/video0] ###
> general info
> VIDIOC_QUERYCAP
> driver : "ipu3-cio2"
> card : "Intel
> IPU3 CIO2" bus_info : "PCI:0000:00:14.3"
> version : 5.3.18
> capabilities : 0x84201000 [?,?,STREAMING,(null)]
>
> standards
>
> inputs
> VIDIOC_ENUMINPUT(0)
> index : 0
> name : "camera"
> type : CAMERA
> audioset : 0
> tuner : 0
> std : 0x0 []
> status : 0x0 []
>
> controls
When I start cheese I have 4 cameras labeled "ipu3-imgu". When I run guvcview I have 10 devices labeled "ipu3-imgu" which the system puts at /dev/video0-9 and four devices labeled "Intel IPU3 CIO2" which are /dev/video10-13.
But none of these work. Does anyone have a laptop with this kind of camera running Linux?
Does anyone know of a resource on debugging this kind of camera in Linux?
brett stevens
(101 rep)
Apr 20, 2020, 07:39 PM
• Last activity: Jun 18, 2025, 02:05 PM
1
votes
1
answers
2742
views
v4l2loopback: Virtual camera exists, but doesn't show up in Zoom, and doesn't work in Cheese
I have successfully set up the virtual camera in OBS: sudo apt install obs-studio v4l2loopback-dkms sudo usermod -aG video myuser The following versions are installed: v4l2loopback-dkms 0.12.5-1 obs-studio 26.1.2+dfsg1-1~ubuntu20.10.1~ppa1 Kernel: 5.11.0-11-lowlatency After a reboot, the virtual cam...
I have successfully set up the virtual camera in OBS:
sudo apt install obs-studio v4l2loopback-dkms
sudo usermod -aG video myuser
The following versions are installed:
v4l2loopback-dkms 0.12.5-1
obs-studio 26.1.2+dfsg1-1~ubuntu20.10.1~ppa1
Kernel: 5.11.0-11-lowlatency
After a reboot, the virtual camera button and settings are showing up in OBS, and clicking the start button creates the following CLI output:
info: Virtual camera started
info: ==== Virtual Camera Start ==========================================
It also seems to work according to v4l2-ctl:
$ v4l2-ctl --list-devices
OBS Virtual Camera (platform:v4l2loopback-000):
/dev/video6
USB 2.0 Camera: USB 2.0 Camera (usb-0000:00:14.0-4.2):
/dev/video4
/dev/video5
/dev/media2
Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-6):
/dev/video0
/dev/video1
/dev/video2
/dev/video3
/dev/media0
/dev/media1
After changing the refresh rate in
OBS -> Settings -> Video
to **30 fps**, the virtual camera also shows up in **Cheese**, but selecting it there, Cheese can not use it and displays an error There was an error playing video from the webcam
. Cheese does not create any CLI output.
In **Zoom**, the virtual camera does not show up in the selection menu at all.
I also experimented with different **color format** settings in OBS -> Settings -> Advanced
, but to no avail, it doesn't affect the outcome.
Any idea what could be a reason?
[Update:] The virtual camera works when using VLC. This to me indicates a problem with the output format. However, I have tested all possible output resolutions, frame rates, and color formats offered by OBS, and none work with Cheese or Zoom.
knipknap
(111 rep)
Apr 11, 2021, 10:08 AM
• Last activity: Jun 17, 2025, 01:10 AM
0
votes
3
answers
2342
views
v4l2-ctl error in script
I can use v4l2-ctl in command line like these: v4l2-ctl -d /dev/video1 -c focus_auto=0 v4l2-ctl -d /dev/video1 -c exposure_auto=0 But it has error when I run them as a script in a file. for example `script.sh` which contains these two lines and run it using `sh script.sh` or call it from c++ `system...
I can use v4l2-ctl in command line like these:
v4l2-ctl -d /dev/video1 -c focus_auto=0
v4l2-ctl -d /dev/video1 -c exposure_auto=0
But it has error when I run them as a script in a file. for example
script.sh
which contains these two lines and run it using sh script.sh
or call it from c++ system()
function:
VIDIOC_S_EXT_CTRLS: failed: Invalid argument
Error setting MPEG controls: Invalid argument
why this error occurs?
Mohammad Etemaddar
(13227 rep)
Feb 1, 2015, 06:44 PM
• Last activity: May 10, 2025, 08:02 AM
0
votes
0
answers
31
views
Custom Linux No /dev/video0 for i2c camera decoder
I am trying to use tw9990 connected to a ATSAMA5D29 to play a camera feed. I have a custom board where the digital data lines are going to the ISC lines of the processor. I have an embedded linux distro made in Buildroot based off the microchip kernel. I am seeing the TW9910 module come up and talk...
I am trying to use tw9990 connected to a ATSAMA5D29 to play a camera feed. I have a custom board where the digital data lines are going to the ISC lines of the processor. I have an embedded linux distro made in Buildroot based off the microchip kernel. I am seeing the TW9910 module come up and talk to the TW9990 chip successfully, but I don't see any /dev/video. I added a small patch to the microchip-isc driver's probe() function which printed "probing" with printk, but I'm not seeing it in dmesg. An interesting, but confusing part of dmesg:
# dmesg | grep isc
device class 'misc': registering
/ahb/apb/isc@f0008000 Linked as a fwnode consumer to /ahb/apb/pinctrl@fc038000
/ahb/apb/isc@f0008000 Dropping the fwnode link to /ahb/apb/pinctrl@fc038000/isc_base
/ahb/apb/isc@f0008000 Dropping the fwnode link to /ahb/apb/pinctrl@fc038000/isc_data_8bit
device: 'platform:fc038000.pinctrl--platform:f0008000.isc': device_add
devices_kset: Moving f0008000.isc to end of list
PM: Moving platform:f0008000.isc to end of list
platform f0008000.isc: Linked as a consumer to fc038000.pinctrl
/ahb/apb/isc@f0008000 Dropping the fwnode link to /ahb/apb/pinctrl@fc038000
bus: 'platform': add driver microchip-sama5d2-isc
/ahb/apb/i2c@f8028000/tw9990@44: Relaxing link with /ahb/apb/isc@f0008000
/ahb/apb/isc@f0008000: Relaxing link with /ahb/apb/i2c@f8028000/tw9990@44
platform f0008000.isc: Fixed dependency cycle(s) with /ahb/apb/i2c@f8028000/tw9990@44
device: 'i2c:0-0044--platform:f0008000.isc': device_add
platform f0008000.isc: Linked as a sync state only consumer to 0-0044
/ahb/apb/isc@f0008000 Dropping the fwnode link to /ahb/apb/i2c@f8028000/tw9990@44
/ahb/apb/i2c@f8028000/tw9990@44: Relaxing link with /ahb/apb/isc@f0008000
i2c 0-0044: Fixed dependency cycle(s) with /ahb/apb/isc@f0008000
device: 'platform:f0008000.isc--i2c:0-0044': device_add
i2c 0-0044: Linked as a sync state only consumer to f0008000.isc
/ahb/apb/i2c@f8028000/tw9990@44 Dropping the fwnode link to /ahb/apb/isc@f0008000
at91_i2c f8028000.i2c: Dropping the link to f0008000.isc
device: 'platform:f0008000.isc--platform:f8028000.i2c': device_unregister
tw9910 0-0044: Dropping the link to f0008000.isc
device: 'platform:f0008000.isc--i2c:0-0044': device_unregister
The device_register and between isc and i2c may be part of the problem, but I don't know why that's happening. The full dmesg is here and the kernel configuration is here .
sbesse
(1 rep)
Dec 12, 2024, 06:06 PM
0
votes
0
answers
213
views
How to set exposure time for ELP-USB4KCAM30H-CFV USB 3.0 camera?
I am trying to set the exposure time for the ELP 4K USB3.0 HDMI USB Camera (`ELP-USB4KCAM30H-CFV`). Unlike the cameras I previously dealt with, it does not support `V4L2_EXPOSURE_MANUAL` where exposure time could be set with `V4L2_CID_EXPOSURE_ABSOLUTE`. Instead, it supports `V4L2_EXPOSURE_SHUTTER_P...
I am trying to set the exposure time for the ELP 4K USB3.0 HDMI USB Camera (
ELP-USB4KCAM30H-CFV
). Unlike the cameras I previously dealt with, it does not support V4L2_EXPOSURE_MANUAL
where exposure time could be set with V4L2_CID_EXPOSURE_ABSOLUTE
. Instead, it supports V4L2_EXPOSURE_SHUTTER_PRIORITY
, but how to set the exposure time for this control method?
Here is the output of v4l2-ctl --device /dev/video4 --list-ctrls-menus
:
User Controls
brightness 0x00980900 (int) : min=0 max=200 step=1 default=100 value=100
contrast 0x00980901 (int) : min=0 max=200 step=1 default=100 value=100
saturation 0x00980902 (int) : min=0 max=200 step=1 default=100 value=100
hue 0x00980903 (int) : min=0 max=360 step=1 default=0 value=0
white_balance_automatic 0x0098090c (bool) : default=1 value=1
gamma 0x00980910 (int) : min=0 max=100 step=1 default=50 value=50
gain 0x00980913 (int) : min=0 max=40 step=1 default=0 value=0
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=1 (50 Hz)
0: Disabled
1: 50 Hz
2: 60 Hz
white_balance_temperature 0x0098091a (int) : min=0 max=150 step=1 default=70 value=70 flags=inactive
sharpness 0x0098091b (int) : min=0 max=200 step=1 default=100 value=100
backlight_compensation 0x0098091c (int) : min=0 max=32 step=1 default=16 value=16
Camera Controls
auto_exposure 0x009a0901 (menu) : min=0 max=3 default=0 value=2 (Shutter Priority Mode)
0: Auto Mode
2: Shutter Priority Mode
exposure_time_absolute 0x009a0902 (int) : min=625 max=320000 step=1 default=5000 value=80000 flags=inactive
Enabling shutter priority mode succeeds:
v4l2-ctl --device /dev/video4 --set-ctrl=auto_exposure=2
Setting exposure_time_absolute
fails. I also tried sudo
and the most recent v4l2-ctl
[1.28.1](https://www.linuxtv.org/downloads/v4l-utils/) but got the same output.
v4l2-ctl --device /dev/video4 --set-ctrl=exposure_time_absolute=625
VIDIOC_S_EXT_CTRLS: failed: Permission denied
Error setting controls: Permission denied
Setting V4L2_CID_EXPOSURE_ABSOLUTE
via ioctl
also fails (returns -1
). I tried values from 0 to 1,000,000.
I even contacted the ELP support, who suggested to use the program [AMCap](http://noeld.com/programs.asp?cat=video) on Windows, which, surprisingly, can set the exposure time (range from -3 to 3). The setting persists when connecting the camera to a different computer. However, I am looking for a less inconvenient solution.
Lastly, I tried enumerating hidden camera controls and found the "Zoom, Absolute" setting at 0x9a090d
with range from 0 to 200, which v4l2-ctl
did not list for some reason. Unfortunately, I did not find a hidden setting for exposure time. AMCap listed both "Exposure" and "Zoom" under "Camera Controls".
Authenticated
(1 rep)
Aug 18, 2024, 04:23 PM
• Last activity: Aug 18, 2024, 04:24 PM
3
votes
1
answers
2190
views
release/close capture of camera
I have opened webcam for capturing using OpenCV in C++. Then I stopped the program using CTRL + Z ; The webcam could not turn off, Because was not defined in program. And I can not start my program again because the capture program is still using webcam and is busy. Error: libv4l2: error setting pix...
I have opened webcam for capturing using OpenCV in C++.
Then I stopped the program using CTRL+Z;
The webcam could not turn off, Because was not defined in program. And I can not start my program again because the capture program is still using webcam and is busy.
Error:
libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
...
I found the process id using
lsof|grep libv4l2
:
capture 5591 mylove mem REG 8,8 52584 1737777 /usr/lib64/libv4l2.so.0.0.0
and tried to close the capture using kill 5591
and also pkill capture
using normal user and root user. But the camera LED is still turned on and my program can not start.
What is fastest and best method to release/close the camera?
Mohammad Etemaddar
(13227 rep)
Dec 16, 2014, 05:53 PM
• Last activity: Aug 7, 2024, 02:03 PM
2
votes
1
answers
436
views
How do you configure a V4L2 device when V4L2 software cannot read a V4L2 stream directly, because they give IO errors?
I'm trying to capture video from an [Elikliv UVC microscope][1] in Linux. We can do direct frame-by-frame capture using this command: ```sh v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=stream.mjpg ``` ... and I can see it live using this big crazy command: ```sh v4l2-ctl --device /dev/vid...
I'm trying to capture video from an Elikliv UVC microscope in Linux.
We can do direct frame-by-frame capture using this command:
v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=stream.mjpg
... and I can see it live using this big crazy command:
v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=/proc/self/fd/1 | \
ffmpeg -i - -fflags discardcorrupt -c:v copy -f matroska - | \
mpv --profile=low-latency -
..but I can't get it to work directly with V4L2-aware software (ie, MPV, VLC, OBS) without the help of v4l2-ctl
to stream it into ffmpeg
and then mpv
.
## **Question:**
Is there a way I can tell configure the V4L2 device to work in a "normal" way, directly from /dev/video0
, without a big crazy pipe?
## MPV says
# mpv /dev/video0
[lavf] avformat_open_input() failed
Failed to recognize file format.
## VLC says
Your input can't be opened:
VLC is unable to open the MRL 'v4l2:///dev/video0'. Check the log for details.
[00007efbdc001120] v4l2 demux error: cannot set format: Input/output error
[00007efbdc001120] v4l2 demux error: not a radio tuner device
[00007efbdc003710] v4l2 stream error: cannot set format: Input/output error
## Other misc info:
# dmesg
[ +0.078764] usb 1-4.3: New USB device found, idVendor=05e3, idProduct=f12b, bcdDevice= 1.00
[ +0.000019] usb 1-4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ +0.000008] usb 1-4.3: Product: GENERAL - UVC
[ +0.000006] usb 1-4.3: Manufacturer: GENERAL
[ +0.002536] usb 1-4.3: Found UVC 1.00 device GENERAL - UVC (05e3:f12b)
[ +0.000287] usb 1-4.3: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ +5.549774] retire_capture_urb: 233 callbacks suppressed
[ +5.000996] retire_capture_urb: 4991 callbacks suppressed
[ +5.000956] retire_capture_urb: 4991 callbacks suppressed
[ +5.001062] retire_capture_urb: 4991 callbacks suppressed
... ...
[ +3.438372] uvcvideo 1-4.3:1.1: Failed to query (130) UVC probe control : -32 (exp. 26).
# v4l2-ctl --list-devices
GENERAL - UVC : GENERAL - UVC (usb-0000:00:14.0-4.3):
/dev/video0
/dev/video1
/dev/media0
# v4l2-ctl --list-formats -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
# v4l2-ctl --list-formats -d /dev/video1
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
# v4l2-ctl --list-formats -d /dev/media0
Unable to detect what device /dev/media0 is, exiting.
# v4l2-ctl -D -d /dev/video0
Driver Info:
Driver name : uvcvideo
Card type : GENERAL - UVC : GENERAL - UVC
Bus info : usb-0000:00:14.0-4.3
Driver version : 6.7.6
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : GENERAL - UVC : GENERAL - UVC
Serial :
Bus info : usb-0000:00:14.0-4.3
Media version : 6.7.6
Hardware revision: 0x00000100 (256)
Driver version : 6.7.6
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : GENERAL - UVC : GENERAL - UVC
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x02000010: from remote pad 0x100000a of entity 'Processing 5': Data, Enabled, Immutable
# v4l2-ctl -D -d /dev/video1
Driver Info:
Driver name : uvcvideo
Card type : GENERAL - UVC : GENERAL - UVC
Bus info : usb-0000:00:14.0-4.3
Driver version : 6.7.6
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04a00000
Metadata Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : GENERAL - UVC : GENERAL - UVC
Serial :
Bus info : usb-0000:00:14.0-4.3
Media version : 6.7.6
Hardware revision: 0x00000100 (256)
Driver version : 6.7.6
Interface Info:
ID : 0x03000005
Type : V4L Video
Entity Info:
ID : 0x00000004 (4)
Name : GENERAL - UVC : GENERAL - UVC
Function : V4L2 I/O
## MPV Verbose output:
# mpv av://v4l2:/dev/video0 --profile=low-latency --untimed --demuxer-lavf-o=video_size=1280x720,input_format=mjpeg -v -v
[cplayer] Command line options: 'av://v4l2:/dev/video0' '--profile=low-latency' '--untimed' '--demuxer-lavf-o=video_size=1280x720,input_format=mjpeg' '-v' '-v'
[cplayer] mpv 0.35.1 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
[cplayer] built on UNKNOWN
[cplayer] FFmpeg library versions:
[cplayer] libavutil 57.28.100
[cplayer] libavcodec 59.37.100
[cplayer] libavformat 59.27.100
[cplayer] libswscale 6.7.100
[cplayer] libavfilter 8.44.100
[cplayer] libswresample 4.7.100
[cplayer] FFmpeg version: 5.1.3
[cplayer]
[cplayer] Configuration: /usr/bin/waf configure --prefix=/usr --bindir=/usr/bin --libdir=/usr/lib64 --mandir=/usr/share/man --docdir=/usr/share/doc/mpv --confdir=/etc/mpv --disable-build-date --enable-libmpv-shared --enable-sdl2 --enable-libarchive --enable-dvdnav --enable-cdda --enable-html-build --enable-dvbin --enable-gl-x11 --enable-wayland
[cplayer] List of enabled features: alsa asm av-channel-layout caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build dmabuf-interop-gl dmabuf-interop-pl dmabuf-wayland drm drm-is-kms dvbin dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo librt linux-fstatfs linux-input-event-codes lua lua_5_1 memfd_create optimize pipewire plain-gl posix posix-or-mingw pthreads pulse rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-libplacebo vaapi-wayland vaapi-x-egl vaapi-x11 vapoursynth vdpau vdpau-gl-x11 vector vt.h vulkan wayland wayland-protocols wayland-protocols-1-24 x11 xv zimg zlib
[global] config path: '' -> '/root/.config/mpv'
[global] user path: '~~home/' -> '/root/.config/mpv'
[global] user path: '~~old_home/' -> '/root/.mpv'
[global] config path: 'encoding-profiles.conf' -/-> '/root/.config/mpv/encoding-profiles.conf'
[global] config path: 'encoding-profiles.conf' -/-> '/root/.mpv/encoding-profiles.conf'
[global] config path: 'encoding-profiles.conf' -> '/etc/mpv/encoding-profiles.conf'
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[global] config path: 'mpv.conf' -/-> '/root/.config/mpv/mpv.conf'
[global] config path: 'config' -/-> '/root/.config/mpv/config'
[global] config path: 'mpv.conf' -/-> '/root/.mpv/mpv.conf'
[global] config path: 'config' -/-> '/root/.mpv/config'
[global] config path: 'mpv.conf' -/-> '/etc/mpv/mpv.conf'
[global] config path: 'config' -/-> '/etc/mpv/config'
[cplayer] Setting option 'profile' = 'low-latency' (flags = 8)
[cplayer] Applying profile 'low-latency'...
[cplayer] Setting option 'audio-buffer' = '0' (flags = 12)
[cplayer] Setting option 'vd-lavc-threads' = '1' (flags = 12)
[cplayer] Setting option 'cache-pause' = 'no' (flags = 12)
[cplayer] Setting option 'demuxer-lavf-o-add' = 'fflags=+nobuffer' (flags = 12)
[cplayer] Setting option 'demuxer-lavf-probe-info' = 'nostreams' (flags = 12)
[cplayer] Setting option 'demuxer-lavf-analyzeduration' = '0.1' (flags = 12)
[cplayer] Setting option 'video-sync' = 'audio' (flags = 12)
[cplayer] Setting option 'interpolation' = 'no' (flags = 12)
[cplayer] Setting option 'video-latency-hacks' = 'yes' (flags = 12)
[cplayer] Setting option 'stream-buffer-size' = '4k' (flags = 12)
[cplayer] Setting option 'untimed' = '' (flags = 8)
[cplayer] Setting option 'demuxer-lavf-o' = 'video_size=1280x720,input_format=mjpeg' (flags = 8)
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Setting option 'v' = '' (flags = 8)
[global] config path: 'input.conf' -/-> '/root/.config/mpv/input.conf'
[global] config path: 'input.conf' -/-> '/root/.mpv/input.conf'
[global] config path: 'input.conf' -/-> '/etc/mpv/input.conf'
[osc] Loading lua script @osc.lua...
[ytdl_hook] Loading lua script @ytdl_hook.lua...
[stats] Loading lua script @stats.lua...
[console] Loading lua script @console.lua...
[osc] loading mp.defaults
[auto_profiles] Loading lua script @auto_profiles.lua...
[ytdl_hook] loading mp.defaults
[global] config path: 'scripts' -/-> '/root/.config/mpv/scripts'
[stats] loading mp.defaults
[global] config path: 'scripts' -/-> '/root/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[cplayer] Waiting for scripts...
[auto_profiles] loading mp.defaults
[console] loading mp.defaults
[osc] loading @osc.lua
[stats] loading @stats.lua
[auto_profiles] loading @auto_profiles.lua
[console] loading @console.lua
[auto_profiles] Exiting...
[console] reading options for console
[global] config path: 'script-opts/console.conf' -/-> '/root/.config/mpv/script-opts/console.conf'
[global] config path: 'script-opts/console.conf' -/-> '/root/.mpv/script-opts/console.conf'
[global] config path: 'script-opts/console.conf' -/-> '/etc/mpv/script-opts/console.conf'
[console] script-opts/console.conf not found.
[global] config path: 'lua-settings/console.conf' -/-> '/root/.config/mpv/lua-settings/console.conf'
[global] config path: 'lua-settings/console.conf' -/-> '/root/.mpv/lua-settings/console.conf'
[global] config path: 'lua-settings/console.conf' -/-> '/etc/mpv/lua-settings/console.conf'
[console] lua-settings/console.conf not found.
[stats] reading options for stats
[global] config path: 'script-opts/stats.conf' -/-> '/root/.config/mpv/script-opts/stats.conf'
[global] config path: 'script-opts/stats.conf' -/-> '/root/.mpv/script-opts/stats.conf'
[global] config path: 'script-opts/stats.conf' -/-> '/etc/mpv/script-opts/stats.conf'
[stats] script-opts/stats.conf not found.
[global] config path: 'lua-settings/stats.conf' -/-> '/root/.config/mpv/lua-settings/stats.conf'
[global] config path: 'lua-settings/stats.conf' -/-> '/root/.mpv/lua-settings/stats.conf'
[global] config path: 'lua-settings/stats.conf' -/-> '/etc/mpv/lua-settings/stats.conf'
[stats] lua-settings/stats.conf not found.
[ytdl_hook] loading @ytdl_hook.lua
[global] config path: 'fonts' -/-> '/root/.config/mpv/fonts'
[global] config path: 'fonts' -/-> '/root/.mpv/fonts'
[global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[osd/libass] ASS library version: 0x1701000 (runtime 0x1701000)
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[osd/libass] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[global] config path: 'subfont.ttf' -/-> '/root/.config/mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/root/.mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[global] config path: 'fonts.conf' -/-> '/root/.config/mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/root/.mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[osd/libass] Setting up fonts...
[ytdl_hook] reading options for ytdl_hook
[global] config path: 'script-opts/ytdl_hook.conf' -/-> '/root/.config/mpv/script-opts/ytdl_hook.conf'
[global] config path: 'script-opts/ytdl_hook.conf' -/-> '/root/.mpv/script-opts/ytdl_hook.conf'
[global] config path: 'script-opts/ytdl_hook.conf' -/-> '/etc/mpv/script-opts/ytdl_hook.conf'
[ytdl_hook] script-opts/ytdl_hook.conf not found.
[global] config path: 'lua-settings/ytdl_hook.conf' -/-> '/root/.config/mpv/lua-settings/ytdl_hook.conf'
[global] config path: 'lua-settings/ytdl_hook.conf' -/-> '/root/.mpv/lua-settings/ytdl_hook.conf'
[global] config path: 'lua-settings/ytdl_hook.conf' -/-> '/etc/mpv/lua-settings/ytdl_hook.conf'
[ytdl_hook] lua-settings/ytdl_hook.conf not found.
[osc] reading options for osc
[global] config path: 'script-opts/osc.conf' -/-> '/root/.config/mpv/script-opts/osc.conf'
[global] config path: 'script-opts/osc.conf' -/-> '/root/.mpv/script-opts/osc.conf'
[global] config path: 'script-opts/osc.conf' -/-> '/etc/mpv/script-opts/osc.conf'
[osc] script-opts/osc.conf not found.
[global] config path: 'lua-settings/osc.conf' -/-> '/root/.config/mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/root/.mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/etc/mpv/lua-settings/osc.conf'
[osc] lua-settings/osc.conf not found.
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Run command: define-section, flags=64, args=[name="input_stats", contents="", flags="default"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_stats", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_forced_stats", contents="", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_forced_stats", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_console", contents="", flags="default"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_console", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_forced_console", contents="", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_forced_console", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="showhide", contents="mouse_move script-binding osc/__keybinding1\nmouse_leave script-binding osc/__keybinding2\n", flags="force"]
[cplayer] Run command: define-section, flags=64, args=[name="showhide_wc", contents="mouse_move script-binding osc/__keybinding3\nmouse_leave script-binding osc/__keybinding4\n", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="showhide", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: enable-section, flags=64, args=[name="showhide_wc", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input", contents="mbtn_left script-binding osc/__keybinding5\nshift+mbtn_left script-binding osc/__keybinding6\nmbtn_right script-binding osc/__keybinding7\nmbtn_mid script-binding osc/__keybinding8\nwheel_up script-binding osc/__keybinding9\nwheel_down script-binding osc/__keybinding10\nmbtn_left_dbl ignore\nshift+mbtn_left_dbl ignore\nmbtn_right_dbl ignore\n", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input", flags=""]
[cplayer] Run command: define-section, flags=64, args=[name="window-controls", contents="mbtn_left script-binding osc/__keybinding11\n", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="window-controls", flags=""]
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-visibility=auto"]
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Run command: disable-section, flags=64, args=[name="input"]
[cplayer] Run command: disable-section, flags=64, args=[name="window-controls"]
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-margins=0.000000,0.000000,0.000000,0.000000"]
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Done loading scripts.
[global] config path: 'watch_later' -> '/root/.config/mpv/watch_later'
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook
[ytdl_hook] not a ytdl:// url
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-margins=0.000000,0.000000,0.000000,0.000000"]
[avdevice] Opening av://v4l2:/dev/video0
[avdevice] resize stream to 4096 bytes, drop 0 bytes
[cplayer] Set property: shared-script-properties -> 1
[osc] osc_init
[avdevice] Stream opened successfully.
[demux] Trying demuxers for level=request.
[demux] Trying demuxer: lavf (force-level: request)
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-margins=0.000000,0.000000,0.000000,0.000000"]
[cplayer] Set property: shared-script-properties -> 1
[global] config path: 'fonts' -/-> '/root/.config/mpv/fonts'
[global] config path: 'fonts' -/-> '/root/.mpv/fonts'
[global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[osd/libass] ASS library version: 0x1701000 (runtime 0x1701000)
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[lavf] Found 'video4linux2,v4l2' at score=100 size=0 (forced).
[osd/libass] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[global] config path: 'subfont.ttf' -/-> '/root/.config/mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/root/.mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[global] config path: 'fonts.conf' -/-> '/root/.config/mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/root/.mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[osd/libass] Setting up fonts...
[ffmpeg/demuxer] video4linux2,v4l2: fd:6 capabilities:84a00001
[lavf] avformat_open_input() failed
[cplayer] Opening failed or was aborted: av://v4l2:/dev/video0
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Running hook: ytdl_hook/on_load_fail
[ytdl_hook] full hook
[cplayer] Run command: define-section, flags=64, args=[name="input_osc", contents="", flags="default"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_osc", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_forced_osc", contents="", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_forced_osc", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] finished playback, unrecognized file format (reason 4)
[cplayer] Failed to recognize file format.
[cplayer]
[cplayer] Exiting... (Errors when loading file)
[ytdl_hook] Exiting...
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="remove", value="osc-margins"]
[cplayer] Set property: shared-script-properties -> 1
[stats] Exiting...
[console] Exiting...
[osc] Exiting...
KJ7LNW
(525 rep)
Mar 24, 2024, 10:13 PM
• Last activity: Mar 26, 2024, 08:06 PM
5
votes
1
answers
2750
views
v4l2loopback devices not showing in applications
I have been successfully using v4l2loopback, with v4l2sink in OBS, to "send" my obs preview panel output to Zoom. The v4l2loopback devices have recently stopped showing in Zoom, Firefox & Brave. However, I can confirm the loopback is viewable in VLC. I'm on: - Pop!_OS (20.10) - v4l2loopback-dkms (0....
I have been successfully using v4l2loopback, with v4l2sink in OBS, to "send" my obs preview panel output to Zoom. The v4l2loopback devices have recently stopped showing in Zoom, Firefox & Brave. However, I can confirm the loopback is viewable in VLC.
I'm on:
- Pop!_OS (20.10)
- v4l2loopback-dkms (0.12.5-1)
- OBS (with the v4l2sink plug-in) (26.0.2+dfsg1-1)
- Zoom (5.4.3)
I normally start the loopback device with the following:
sudo modprobe v4l2loopback video_nr=99 card_label="OBS Video Source" exclusive_caps=1
This is usually run on boot via:
$ cat /etc/modprobe.d/v4l2loopback.conf
options v4l2loopback video_nr=99 card_label="OBS Video Source" exclusive_caps=1
$ cat /etc/modules-load.d/v4l2loopback.conf
v4l2loopback
The device shows via v4l2-ctl:
v4l2-ctl --list-devices
OBS Video Source (platform:v4l2loopback-000):
/dev/video99
Cam Link 4K: Cam Link 4K (usb-0000:06:00.1-4):
/dev/video2
/dev/video3
UVC Camera (046d:0990) (usb-0000:06:00.3-1):
/dev/video0
/dev/video1
and once I start the v4l2sink in OBS, I can view this in VLC. However, as mentioned, the
OBS Video Source
device is no longer showing up in any applications that I've tried, as a selectable source.
How can I get the OBS Video Source
show up as a source in Zoom again?
Gaynor Cosgrove
(51 rep)
Nov 25, 2020, 01:41 PM
• Last activity: Mar 20, 2024, 06:45 AM
1
votes
0
answers
1811
views
How to get proper ffplay output with UVC camera?
My end goal is to use a UVC webcam with esp32 or Raspberry PI. I was hoping to learn while doing some fun projects. I have an old UVC webcam (Creative model ct6840) but I can't seem to get it to work with `ffplay`. I have tried looking through the documentation and other questions here but I can't s...
My end goal is to use a UVC webcam with esp32 or Raspberry PI. I was hoping to learn while doing some fun projects.
I have an old UVC webcam (Creative model ct6840) but I can't seem to get it to work with
Can someone help me understand how to make the camera work with
ffplay
. I have tried looking through the documentation and other questions here but I can't seem to get it to work. So far I have only been able to achieve a noisy-jittery output.
Running
-shell
ffplay -f rawvideo -video_size 640x480 /dev/video2
I get:

ffplay
or ffmpeg
?
The following is the information of my webcam:
-shellsession
$ ffmpeg -f v4l2 -list_formats all -i /dev/video2
[video4linux2,v4l2 @ 0x17eb3c0] Compressed: Unsupported : GSPCA OV511 : 320x240 640x480
$ v4l-info /dev/video2
### v4l2 device info [/dev/video2] ###
general info
VIDIOC_QUERYCAP
driver : "ov519"
card : "USB Camera (05a9:0511)"
bus_info : "usb-0000:00:14.0-8.2"
version : 6.1.79
capabilities : 0x85200001 [VIDEO_CAPTURE,?,READWRITE,STREAMING,(null)]
standards
inputs
VIDIOC_ENUMINPUT(0)
index : 0
name : "ov519"
type : CAMERA
audioset : 0
tuner : 0
std : 0x0 []
status : 0x0 []
video capture
VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
index : 0
type : VIDEO_CAPTURE
flags : 1
description : "GSPCA OV511"
pixelformat : 0x3131354f [O511]
VIDIOC_G_FMT(VIDEO_CAPTURE)
type : VIDEO_CAPTURE
fmt.pix.width : 640
fmt.pix.height : 480
fmt.pix.pixelformat : 0x3131354f [O511]
fmt.pix.field : NONE
fmt.pix.bytesperline : 640
fmt.pix.sizeimage : 614400
fmt.pix.colorspace : JPEG
fmt.pix.priv : 4276996862
controls
VIDIOC_QUERYCTRL(BASE+0)
id : 9963776
type : INTEGER
name : "Brightness"
minimum : 0
maximum : 255
step : 1
default_value : 127
flags : 48
VIDIOC_QUERYCTRL(BASE+1)
id : 9963777
type : INTEGER
name : "Contrast"
minimum : 0
maximum : 255
step : 1
default_value : 127
flags : 32
VIDIOC_QUERYCTRL(BASE+2)
id : 9963778
type : INTEGER
name : "Saturation"
minimum : 0
maximum : 255
step : 1
default_value : 127
flags : 32
VIDIOC_QUERYCTRL(BASE+24)
id : 9963800
type : MENU
name : "Power Line Frequency"
minimum : 0
maximum : 2
step : 1
default_value : 0
flags : 0
VIDIOC_QUERYCTRL(BASE+32)
id : 9963808
type : BOOLEAN
name : "Brightness, Automatic"
minimum : 0
maximum : 1
step : 1
default_value : 1
flags : 8
Can someone guide me here please? Any advice will be greatly appreciated~
(NOTE: the camera works perfectly with guvcview
and xawtv
... so it can work with ffmpeg
, right?)
Abdulla Masud
(15 rep)
Mar 1, 2024, 09:46 PM
• Last activity: Mar 5, 2024, 02:27 PM
2
votes
2
answers
2442
views
How can I persist the modified V4L2 (Guvcview) profile of a webcam?
I have a USB web camera that gives suboptimal results when I plug it in (Linux seems to apply its own V4L2 settings to it that it thinks are best, they are not). Mainly, it operates at a low FPS. But if I open Guvcview, select "Settings" -> "Hardware defaults" in the menu, and add some minor modific...
I have a USB web camera that gives suboptimal results when I plug it in (Linux seems to apply its own V4L2 settings to it that it thinks are best, they are not). Mainly, it operates at a low FPS. But if I open Guvcview, select "Settings" -> "Hardware defaults" in the menu, and add some minor modifications, I can get a higher FPS and overall better quality.
If I close Guvcview and open it again, the settings are reset in Guvcview, but the changes I made stay active in other apps like video chat software. However, if I unplug the webcam, the changes are lost everywhere, and after plugging in again I have a worse quality again.
What I do for now is I saved the changes in Guvcview as a .gpfl file (menu -> "Settings" -> "Save profile"), and whenever I reconnect the webcam, I open Guvcview and load the profile with "Load profile".
How can I make these settings persist so that I never have to do this again, and have them applied to only this specific video device and not others?
ostrich
(21 rep)
Apr 25, 2023, 01:34 AM
• Last activity: Jan 3, 2024, 04:33 PM
4
votes
1
answers
1717
views
Use guvcview to setup Logitech C920 webcam and keep configuration
I have a Logitech C920 webcam connected to my computer running Debian Linux. I want to access the stream by using mplayer (/dev/video0) and it works out of the box. However, the saturation/brightness/other settings are not correct, so I use guvcview to set the proper configuration. If I keep the pre...
I have a Logitech C920 webcam connected to my computer running Debian Linux. I want to access the stream by using mplayer (/dev/video0) and it works out of the box. However, the saturation/brightness/other settings are not correct, so I use guvcview to set the proper configuration.
If I keep the preview window from guvcview open, I can't connect to the stream anymore because the device is busy (= in use by guvcview). mplayer returns an error. If I close guvcview my settings are gone and the stream is 640x480 again (instead of 1280x720). I get the same error when using openCV to connect to the stream:
- without guvcview: connected, but bad settings
- with guvcview running: good settings, but can't connect to /dev/video from any other programs (blocked by guvcview)
Here are some parts of the console output when setting the configuration in guvcview. I don't know if its helpful:
V4L2_CORE: Unable to find parent usb device.V4L2_CORE: Unable to find
parent usb device.GUVCVIEW: version 2.0.4
V4L2_CORE: (UVCIOC_CTRL_MAP) Error: Inappropriate ioctl for device
V4L2_CORE: failed to subscribe events for control 0x00980001:
Inappropriate ioctl for device
V4L2_CORE: failed to subscribe events for control 0x0098f900:
Inappropriate ioctl for device
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for
4294967295, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for
4294967295, skipping unlock
Jonathan M
(41 rep)
Apr 3, 2018, 11:51 AM
• Last activity: Dec 5, 2023, 02:10 PM
2
votes
1
answers
1757
views
Adjusting keyframe rate ffmpeg/v4l2 Logitech C920 to YouTube Live
I am trying to stream video from a Logitech c920 to YouTube live via ffmpeg. I have a setup that works in Twitch, but YouTube rejects the stream with the message: > Please use a keyframe frequency of four seconds or less. Currently, keyframes are not being sent often enough, which will cause bufferi...
I am trying to stream video from a Logitech c920 to YouTube live via ffmpeg. I have a setup that works in Twitch, but YouTube rejects the stream with the message:
> Please use a keyframe frequency of four seconds or less. Currently, keyframes are not being sent often enough, which will cause buffering. The current keyframe frequency is 9.9 seconds.
My command looks like this:
ffmpeg \
-ar 44100 \
-acodec pcm_s16le \
-f s16le \
-ac 2 -i /dev/null \
-f v4l2 \
-codec:v h264 \
-framerate 60 \
-video_size 1920x1080 \
-i /dev/video0 \
-c:v copy \
-c:a aac \
-f flv \
-strict -2 \
rtmp://a.rtmp.youtube.com/live2/$STREAM_KEY
And in the logs ffmpeg gives this message:
[video4linux2,v4l2 @ 0x2965ec0] The driver changed the time per frame from 1/60 to 1/30
Does anyone know a way to force the camera, v4l2 or ffmpeg to provide keyframes at a suitable rate?
Thanks.
Dan
(21 rep)
Jan 25, 2017, 06:40 AM
• Last activity: Sep 26, 2023, 08:07 PM
0
votes
2
answers
880
views
V4L2: Why image taken with shortest exposure-time looks way too brighter than auto-exposure mode?
When capturing image using the default auto-exposure-mode: $ v4l2-ctl -d0 --set-fmt-video=width=width,height=height,pixelformat=MJPG --stream-mmap --stream-to=auto_expo.jpg --stream-count=1 auto_expo.jpg shows: [![enter image description here][1]][1] But when capturing image using the manual exposur...
When capturing image using the default auto-exposure-mode:
$ v4l2-ctl -d0 --set-fmt-video=width=width,height=height,pixelformat=MJPG --stream-mmap --stream-to=auto_expo.jpg --stream-count=1
auto_expo.jpg shows:
But when capturing image using the manual exposure, using shortest possible exposure value of 4:
$ v4l2-ctl -d0 -c exposure_auto=1
$ v4l2-ctl -d0 -c exposure_absolute=4
$ v4l2-ctl -d0 --set-fmt-video=width=width,height=height,pixelformat=MJPG --stream-mmap --stream-to=manual_expo.jpg --stream-count=1
manual_expo.jpg shows
V4L2 Values Before:
$ v4l2-ctl -d0 --list-ctrls
brightness 0x00980900 (int) : min=0 max=15 step=1 default=8 value=8
contrast 0x00980901 (int) : min=0 max=15 step=1 default=8 value=8
saturation 0x00980902 (int) : min=0 max=15 step=1 default=7 value=7
hue 0x00980903 (int) : min=-10 max=10 step=1 default=0 value=0
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gamma 0x00980910 (int) : min=1 max=10 step=1 default=7 value=7
gain 0x00980913 (int) : min=0 max=0 step=0 default=0 value=0
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=2
white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=2800 value=2800 flags=inactive
sharpness 0x0098091b (int) : min=0 max=15 step=1 default=6 value=6
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=0 value=0
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
exposure_absolute 0x009a0902 (int) : min=4 max=5000 step=1 default=625 value=625 flags=inactive
focus_absolute 0x009a090a (int) : min=0 max=21 step=1 default=16 value=16 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1
V4L2 Values After:
$ v4l2-ctl -d0 --list-ctrls
brightness 0x00980900 (int) : min=0 max=15 step=1 default=8 value=8
contrast 0x00980901 (int) : min=0 max=15 step=1 default=8 value=8
saturation 0x00980902 (int) : min=0 max=15 step=1 default=7 value=7
hue 0x00980903 (int) : min=-10 max=10 step=1 default=0 value=0
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gamma 0x00980910 (int) : min=1 max=10 step=1 default=7 value=7
gain 0x00980913 (int) : min=0 max=0 step=0 default=0 value=0
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=2
white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=2800 value=2800 flags=inactive
sharpness 0x0098091b (int) : min=0 max=15 step=1 default=6 value=6
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=0 value=0
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=1
exposure_absolute 0x009a0902 (int) : min=4 max=5000 step=1 default=625 value=4
focus_absolute 0x009a090a (int) : min=0 max=21 step=1 default=16 value=16 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1


Garid Z.
(552 rep)
Jun 3, 2022, 06:59 AM
• Last activity: Mar 27, 2023, 01:49 PM
1
votes
0
answers
179
views
Unable to create device file of v4l2 framework
Cannot create `/dev/video0` when I try to probing `ov7670` driver in Linux run on Zedboard. The kernel version I'm using is `5.4` , I use `Petalinux` version 2021.1 to build Linux project and also enable the `ov7670` driver in kernel source and I use `Vivado 2020.2` to build the hardware design.The...
Cannot create
/dev/video0
when I try to probing ov7670
driver in Linux run on Zedboard. The kernel version I'm using is 5.4
, I use Petalinux
version 2021.1 to build Linux project and also enable the ov7670
driver in kernel source and I use Vivado 2020.2
to build the hardware design.The driver detected ov7670
chip successfully but still cannot create /dev/video0
. My hardware design include (ov7670
capture IP core mainly use to convert 8 bit data of camera to axis stream, VDMA
IP core to store and retrieve data , I2C for the camera configuration). My question is do i need an IP core like Xilinx VPSS(Video Processing Subsystem)
or Xilinx Test Pattern Generator (TPG)
act as an endpoint to attach with the camera. Please help me.
thinh can
(11 rep)
Mar 4, 2023, 07:55 AM
• Last activity: Mar 4, 2023, 04:12 PM
2
votes
0
answers
471
views
Webcam's power line frequency setting does not take effect if a new application that uses it is open
I am living in Europe and I have bought a Logitech C920 webcam whose power line frequency setting should be changed to 50Hz in order to avoid flickering. I did it using the following instruction: ``` /usr/bin/v4l2-ctl --d /dev/video0 --set-ctrl power_line_frequency=1 ``` That worked properly and I e...
I am living in Europe and I have bought a Logitech C920 webcam whose power line frequency setting should be changed to 50Hz in order to avoid flickering. I did it using the following instruction:
/usr/bin/v4l2-ctl --d /dev/video0 --set-ctrl power_line_frequency=1
That worked properly and I even tried to make it persistent using udevadm
rules:
SUBSYSTEM=="video4linux", KERNEL=="video[0-9]*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08e5", RUN+="/usr/bin/v4l2-ctl -d $devnode --set-ctrl=power_line_frequency=1"
That also seemed to work since v4l2-ctl -d /dev/video0 --list-ctrls
gives the following output after rebooting system or after plug out - in the webcam usb:
brightness 0x00980900 (int) : min=0 max=255 step=1 default=128 value=128
contrast 0x00980901 (int) : min=0 max=255 step=1 default=128 value=128
saturation 0x00980902 (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gain 0x00980913 (int) : min=0 max=255 step=1 default=0 value=0
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=1 (50 Hz)
white_balance_temperature 0x0098091a (int) : min=2800 max=7500 step=1 default=5000 value=5000 flags=inactive
sharpness 0x0098091b (int) : min=0 max=255 step=1 default=128 value=128
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=0 value=0
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
exposure_absolute 0x009a0902 (int) : min=3 max=2047 step=1 default=156 value=156 flags=inactive
exposure_auto_priority 0x009a0903 (bool) : default=0 value=1
pan_absolute 0x009a0908 (int) : min=-36000 max=36000 step=3600 default=0 value=0
tilt_absolute 0x009a0909 (int) : min=-36000 max=36000 step=3600 default=0 value=0
focus_absolute 0x009a090a (int) : min=0 max=250 step=1 default=0 value=0 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1
zoom_absolute 0x009a090d (int) : min=100 max=500 step=1 default=100 value=100
As you can see, power_line_frequency
setting is set to value 1 (50Hz), which is correct. However, if I start an application that uses the webcam like Skype, Zoom or Discord and I see the webcam output video, it is still flickering (although value of power_line_frequency
is still 1). However, it is fixed if I execute again /usr/bin/v4l2-ctl --d /dev/video0 --set-ctrl power_line_frequency=1
or even sudo udevadm trigger
to run udevadm
rule manually.
Does anyone know why could this be happening or how could it be fixed?
PD: I am using Ubuntu 22.04 with Kernel 5.15.0-56.
Thank you so much in advance.
Roberto Fernández Iglesias
(21 rep)
Dec 30, 2022, 03:26 PM
9
votes
2
answers
25310
views
Adding and removing v4l2-loopback devices?
I have different lxc containers running on my machine and a webcam is also attached. I want all of the lxc containers to access this camera. I came across 'v4l2-loopback' devices and found a way to add devices using; modprobe v4l2loopback devices=3 And I directed the stream from /dev/video0 to the d...
I have different lxc containers running on my machine and a webcam is also attached. I want all of the lxc containers to access this camera. I came across 'v4l2-loopback' devices and found a way to add devices using;
modprobe v4l2loopback devices=3
And I directed the stream from /dev/video0 to the desired virtual video devices.
My question is how to add and remove these v4l2loopback devices at runtime? I want to add/remove a device whenever any lxc container is launched/deleted. Any ideas?
Thanks!
beenum
(91 rep)
Mar 29, 2017, 10:54 AM
• Last activity: Dec 21, 2022, 05:18 PM
1
votes
1
answers
1461
views
How to know the V4L2 camera's exposure time in ms?
with `v4l2-ctl`, one can know camera-parameters with following: $ v4l2-ctl -d2 --list-ctrls brightness 0x00980900 (int) : min=0 max=255 step=1 default=128 value=128 contrast 0x00980901 (int) : min=0 max=31 step=1 default=16 value=16 gamma 0x00980910 (int) : min=0 max=127 step=1 default=64 value=64 g...
with
v4l2-ctl
, one can know camera-parameters with following:
$ v4l2-ctl -d2 --list-ctrls
brightness 0x00980900 (int) : min=0 max=255 step=1 default=128 value=128
contrast 0x00980901 (int) : min=0 max=31 step=1 default=16 value=16
gamma 0x00980910 (int) : min=0 max=127 step=1 default=64 value=64
gain 0x00980913 (int) : min=1 max=33 step=1 default=0 value=33
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=2 (60 Hz)
sharpness 0x0098091b (int) : min=0 max=15 step=1 default=1 value=1
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=1 (Manual Mode)
exposure_absolute 0x009a0902 (int) : min=1 max=1856 step=1 default=2500 value=2500
I understand last one exposure_absolute
is the exposure, but I'm not sure whether this is **always in ms**. Or some other unit (perhaps specific for each cam) that has to be converted to ms?
Garid Z.
(552 rep)
Nov 26, 2021, 02:38 AM
• Last activity: Jul 13, 2022, 08:21 PM
0
votes
1
answers
266
views
How to make sure images captured by FFMPEG from USB is lossless?
I'm to capturing 10 images from camera. Like so: ffmpeg -hide_banner -loglevel error -f video4linux2 -i /dev/video0 -vframes 10 -video_size 640x480 test%3d.jpg [Since JPG is lossly][1], at I need to change the image format. Let's say `tiff`. Like so: ffmpeg -hide_banner -loglevel error -f video4linu...
I'm to capturing 10 images from camera. Like so:
ffmpeg -hide_banner -loglevel error -f video4linux2 -i /dev/video0 -vframes 10 -video_size 640x480 test%3d.jpg
Since JPG is lossly , at I need to change the image format. Let's say
tiff
. Like so:
ffmpeg -hide_banner -loglevel error -f video4linux2 -i /dev/video0 -vframes 10 -video_size 640x480 test%3d.tiff
Does this ensure, image files are lossless as we got from camera?
Or since It's using -vframes 10
it works like a 10 frame video, and ffmpeg uses some video compression at each frame (making some information loss)?
/I'm sorry if this is a stupid question/
Garid Z.
(552 rep)
Apr 13, 2022, 10:01 AM
• Last activity: Apr 13, 2022, 10:16 AM
2
votes
1
answers
654
views
Why would USB video be dropping frames in Realtime Linux?
We have a problem of losing about one frame every 60 seconds or so with four USB cameras hooked up to Ubuntu 20.04 with the Realtime Linux patches applied. From the user code `ioctl(VIDIOC_DQBUF)` call level we see that `v4l2_buffer.sequence` skips a buffer, but with no error reported. What makes it...
We have a problem of losing about one frame every 60 seconds or so with four USB cameras hooked up to Ubuntu 20.04 with the Realtime Linux patches applied. From the user code
ioctl(VIDIOC_DQBUF)
call level we see that v4l2_buffer.sequence
skips a buffer, but with no error reported. What makes it odd is that one camera doesn't skip, but three do, even though they are all on separate USB ports.
Looking at the kernel debug information we see info like this:
Jan 21 08:48:52 kernel: [ 612.290354] uvcvideo: frame 1955 stats: 0/151/151 packets, 0/0/151 pts (!early initial), 0/151 scr, last pts/stc/sof 0/0/0
Jan 21 08:48:52 kernel: [ 612.291017] uvcvideo: frame 1940 stats: 0/151/151 packets, 0/0/151 pts (!early initial), 0/151 scr, last pts/stc/sof 0/0/0
Jan 21 08:48:52 kernel: [ 612.294264] uvcvideo: frame 1956 stats: 0/9/9 packets, 0/0/9 pts (!early initial), 0/9 scr, last pts/stc/sof 0/0/0
Jan 21 08:48:52 kernel: [ 612.294269] uvcvideo: Marking buffer as bad (error bit set).
Jan 21 08:48:52 kernel: [ 612.294270] uvcvideo: Frame complete (FID bit toggled).
Jan 21 08:48:52 kernel: [ 612.294270] uvcvideo: frame 1957 stats: 0/1/1 packets, 0/0/0 pts (!early !initial), 0/1 scr, last pts/stc/sof 0/1217480818/18547
Jan 21 08:48:52 kernel: [ 612.294272] uvcvideo: Marking buffer as bad (error bit set).
Jan 21 08:48:52 kernel: [ 612.294678] uvcvideo: frame 1958 stats: 0/2/2 packets, 0/0/0 pts (!early !initial), 0/1 scr, last pts/stc/sof 0/1217480818/18547
Jan 21 08:48:52 kernel: [ 612.294682] uvcvideo: Marking buffer as bad (error bit set).
Jan 21 08:48:52 kernel: [ 612.294682] uvcvideo: Frame complete (FID bit toggled).
Jan 21 08:48:52 kernel: [ 612.294683] uvcvideo: frame 1959 stats: 0/1/1 packets, 0/0/0 pts (!early !initial), 0/1 scr, last pts/stc/sof 0/1267616628/19316
Jan 21 08:48:52 kernel: [ 612.294685] uvcvideo: Marking buffer as bad (error bit set).
Jan 21 08:48:52 kernel: [ 612.294686] uvcvideo: Frame complete (EOF found).
Jan 21 08:48:52 kernel: [ 612.294888] uvcvideo: Dropping payload (out of sync).
Jan 21 08:48:52 kernel: [ 612.295094] uvcvideo: Marking buffer as bad (error bit set).
Jan 21 08:48:52 kernel: [ 612.295094] uvcvideo: Dropping payload (out of sync).
Jan 21 08:48:52 kernel: [ 612.295299] uvcvideo: Dropping payload (out of sync).
Jan 21 08:48:52 kernel: [ 612.295509] uvcvideo: Marking buffer as bad (error bit set).
Jan 21 08:48:52 kernel: [ 612.295510] uvcvideo: Dropping payload (out of sync).
Jan 21 08:48:52 kernel: [ 612.295715] uvcvideo: frame 1960 stats: 0/5/5 packets, 2/4/3 pts (!early !initial), 2/3 scr, last pts/stc/sof 1284525428/1284525171/19827
Looking at the source code, Frame complete (FID bit toggled)
means that the USB driver hasn't sent the complete frame (otherwise we would get an (EOF found)
message), which is backed up by the log showing 0/2/2 packets
instead of 0/151/151
.
How do I proceed with the debugging now? I find it hard to believe that the USB driver is buggy, but is there some not quite RTLinux-ready component in the stack?
Ken Y-N
(251 rep)
Jan 26, 2022, 12:09 AM
• Last activity: Jan 26, 2022, 03:39 AM
Showing page 1 of 20 total questions