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

v4l2loopback-ctl set-caps hint uses deprecated format #248

Closed
ntorresalberto opened this issue Jun 11, 2023 · 9 comments
Closed

v4l2loopback-ctl set-caps hint uses deprecated format #248

ntorresalberto opened this issue Jun 11, 2023 · 9 comments
Labels

Comments

@ntorresalberto
Copy link

ntorresalberto commented Jun 11, 2023

Overview
Droidcam suggests how to change the format but the message uses an oudated command on v4l2loopback-ctl.

I provide the complete log as well as the final command that fixes it.

LOG

[user@fedora ~]$ droidcam
Fatal: droidcam video device reported pixel format 34524742 (BGR4), expected 32315559 (YU12/I420)
Try 'v4l2loopback-ctl set-caps "video/x-raw, format=I420, width=640, height=480" /dev/video<N>'

[user@fedora ~]$ v4l2loopback-ctl set-caps "video/x-raw, format=I420, width=640, height=480" /dev/video<N>
bash: syntax error near unexpected token `newline'

[user@fedora ~]$ v4l2loopback-ctl set-caps "video/x-raw, format=I420, width=640, height=480" /dev/video
WARNING: 'v4l2loopback-ctl set-caps <caps> <image>' is deprecated!
WARNING: use 'v4l2loopback-ctl set-caps <device> <caps>' instead.
ERROR: GStreamer-style caps are no longer supported!
ERROR: use '<FOURCC>:<width>x<height>[@<fps>] instead
       e.g. 'UYVY:640x480@30/1' or 'RGBA:1024x768'

[user@fedora ~]$ v4l2loopback-ctl set-caps /dev/video "I420:640x480@30/1"
unable to set requested format: Invalid argument

[user@fedora ~]$ v4l2loopback-ctl set-caps /dev/video "I420:640x480"
unable to set requested format: Invalid argument

[user@fedora ~]$ v4l2loopback-ctl set-caps /dev/video "YU12:640x480"

System is running droicam 2.0.0 and Fedora 38 (with v4l2loopback from repos).

In conclusion

  • The original command has a <N> that should not be there.
  • v4l2loopback-ctl was updated and the command is wrong anyways, droicam should suggest something along the lines of: v4l2loopback-ctl set-caps /dev/video "YU12:640x480"

PS: Thank you for this great app!

@sergiotca
Copy link

sergiotca commented Jun 12, 2023

This!

Your suggestion v4l2loopback-ctl set-caps /dev/video "YU12:640x480" actually fixed the issue I had this morning when updating to 6.3.6 under Fedora

*EDIT: I just realized I need to do this again after every system reboot for droidcam to work.
Any way to make this survive reboot?

@aramg
Copy link
Collaborator

aramg commented Jun 12, 2023

  • Video devices are usually numbered, /dev/video0, /dev/video1, ..., which is why the <N> is there.
    I have not verified, but I assume the /dev/video you are seeing is a symlink to the default device.

  • The set-caps format does need to be updated in the error message

@aramg aramg changed the title outdated message veo format is wrong v4l2loopback-ctl set-caps hint uses deprecated format Jun 12, 2023
@aramg aramg added the bug label Jun 12, 2023
@ntorresalberto
Copy link
Author

ntorresalberto commented Jun 12, 2023

  • Video devices are usually numbered, /dev/video0, /dev/video1, ..., which is why the <N> is there.
    I have not verified, but I assume the /dev/video you are seeing is a symlink to the default device.
  • The set-caps format does need to be updated in the error message

I'm not sure why it works but there's no /dev/video there:

$ ls -lha /dev/video* 
crw-rw----+ 1 root video 81, 0 Jun 11 23:11 /dev/video0

I can confirm what @sergiotca says. I also need to run the v4l2loopback-ctl command after restart to fix it (and I'm also on Fedora).

@sergiotca
Copy link

Sorry to bump this but I still need to do this every time I reboot for droidcam to work.

Anyone know a way to make this fix permanent?

@aramg
Copy link
Collaborator

aramg commented Aug 22, 2023

Will have to carve out some time too look into this in a Fedora dev env.

The only option I see is trying to set keep_format to 1, and see if that makes it survive reboot.
https://github.com/umlaeute/v4l2loopback#attributes

There isn't a module option to set the format at load time (https://github.com/umlaeute/v4l2loopback#options), which is btw the main difference with the version of v4l2loopback that comes with the droidcam client.

@mak448a
Copy link

mak448a commented Nov 4, 2023

Sorry to bump this but I still need to do this every time I reboot for droidcam to work.

Anyone know a way to make this fix permanent?

Try adding it to bashrc

@mak448a
Copy link

mak448a commented Dec 26, 2023

Any way to fix the error that happens now with the command v4l2loopback-ctl set-caps /dev/video "YU12:640x480"?
It says this:

VIDIOC_G_FMT: Invalid argument
unable to set requested format: Invalid argument

@aramg
Copy link
Collaborator

aramg commented Dec 27, 2023

Try v4l2loopback-ctl get-caps /dev/video, if the caps are already set then you may not be able to change it.
The latest droidcam client release essentially does a set-caps now.

@mak448a
Copy link

mak448a commented Dec 28, 2023

I just had to update droidcam. Thanks!

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

No branches or pull requests

4 participants