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
Output resolution does not change when source resolution changes #678
Comments
For the video recordingMost video codecs only support compressing the video frames at a fixed resolution (ignoring possible hacks or extensions), so saving video frames of different resolutions in the same file is not possible, when you start recording, Webcamoid will take the resolution of the source currently in use, and weep it until you stop the recording, if you want to record at a different resolution, stop the current recording and start a new one. For the virtual cameraYou can't change the video resolution while it's being in use because it's not technically possible, if you want a different resolution in the client program you have to close the client program, change the source, and open the client program again. Create a virtual camera:
Play a video and send it to the virtual camera:
Use the client program to capture the virtual camera:
Cntrl+C ffmpeg while the client client program is still capturing the frames. The client program will get stuck with the last frame captured, and waiting for more.
The result is that the client program won't get the frames of Video2, and still will get stuck with the last frame of Video1, because the video capture format is always fixated in the client, and this is not neither a bug in the client, the driver, or the source program, and obviously not a bug in Webcamoid. In resumeThe issue at #379 should have been fixed taking into account the previous considerations. |
Ignoring "it'd be cool if this worked though it might be hacky" live switching, which isn't realistic for all the reasons you describe, I still could not get the output resolution to change at all. I did some extra verification:
That being said, you mentioned the I think I can hack my way around this for the time being by running webcamoid twice. One with the webcam as the input outputting a virtual camera at the desired resolution, and again using the virtual camera as an input, then recording and outputting the virtual camera again to also be able to use that for client programs. I've confirmed that using a second webcamoid taking the virutal camera as input does record at the correct resolution, so something just isn't acknowledging when the source resolution changes, even if I'm not already recording when the change is made. Unfortunately akvcam seems to be a bit buggy on my system and occasionally it will hang any program that tries to grab the virtual camera device. This happened once before trying to run two webcamoids, for the record. Will keep messing with it for the time being. Sorry if all of this isn't clear, I'm writing and troubleshooting at the same time and doing my best to go back and try to make it comprehensible afterwords. :) |
As I understand, you tested it with v4l2loopback, right? You are missing another test, try running this command without Webcamoid running:
this will be the output:
And this is because v4l2loopback does not define any format if the source is not sending any frame, and the resolution can't be changed on fly because v4l2loopback is a pass-through driver. So that, once the source playback has started v4l2loopback plugin will take and keep the resolution of the output even if you switch to another source, and it will be like that until you stop the playback, switch to the wanted source, then playback again. If I did not have programmed like that, the client would have experienced the same behavior explained in the previous post.
Recording should take the resolution of the source when started, if it does not do that, it's probably a bug.
More like I did not programmed that functionality yet because is not prioritary for now, I'm more focused on getting the Android APK working smooth (for attracting more users), or moving video processing to Vulkan or OpenGL (for performance improvement), or improving the plugin system (for attracting more developers).
If I remember well this bug was probably solved in the daily build. And yes, this is because it is detecting Webcamoid as a client.
I have fixed many bugs with latest release, yet it still may need some more, and I still need to optimize the code a lot.
Don't worry, I understand that all this topic is complex to explain and understand. |
Ahh I found an interesting behavior of this.
But if I don't stop ffplay when changing sources, v4l2loopback gets messed up and stuck at the last resolution and I have to reload the driver for it to change resolutions. When it tries to change resolutions it stops playing back in ffplay, as expected, but it stays in an error state after restarting ffplay. Resolution wrong, screen pink, etc. Not a webcamoid bug at all but just interesting. Speaking of which, I was going to say "akvcam has been working fine since I rebooted it!" but at some point it got messed up and started locking anything that touched it and I had to reboot again. Unless I find a way to un freeze it I'll have to avoid using it for the time being, force stopping the module and even deleting the virtual camera devices didn't fix the programs after they hung, nor did I hope the bugs can be worked out soon because the features are nice. Unfortunately I'm not a driver developer or I'd give it a shot. Getting back on track a bit,
Always ends up 640x480. Changing the source to a screen input and back does change the recording resolution. I'm not sure why it was stuck at 640x480 doing the using-two-webcamoid-processes, using virtual camera as input device to get the correct resolution. I know the resolution going into the second webcamoid process was not 480p, and the output from the second virutal device was not 480p. Maybe switching to a screen capture and back would have done it, but I didn't test that while akvcam was working. I did notice that if I change the device resolution in webcamoid, change input devices to screen 0 so the webcam device is no longer being used, and then ffplay the real webcam device, it does open in the last resolution I set it to. Not 640x480. This is to say, webcamoid is changing it to 640x480 every time it opens it. I think if it opened in the last saved resolution it might record and output at that as well, perhaps after restarting the program or something. The problems right now seem to revolve around everything setting to 640x480 when the webcam is opened and not changing, even when they are in a state in which it should be safe to do so. Not recording, output device not being used. I'll probably have to find another workaround for the time being. I can't figure out any way to get the output device to not end up 640x480 with the v4l2loopback driver and the webcam as the source device. Let me know if there's anything else I can test on my side. |
Are you using the latest version? Result of
Ok, will check then.
You are going a lot much faster than the questions I can have 😄 |
Kernel 6.5.0-4-amd64 and akvcam 1.2.4. Had to look at the akvcam install logs to get the version. For what it's worth I found OBS can do what I need for my particular use case. Webcamoid is nicer UI wise but I wasn't making use of the plugins or other Webcamoid specific features. Also happens to help out my dependency situation, but that's an issue entirely of my own doing. |
Hello, o/ i installed the appimage yesterday, any fix in next weeks ? |
Maybe a solution would be allow to set a fixed (but configurable) output resolution for both the recording and the virtual camera? would that be ok? |
yes it is ok on my side, thx for your help, works fine |
README
Some considerations before doing anything:
(I read all of that :) )
Reporting a problem?
Summary
Output resolution doesn't change if the source resolution changes.
Current Behavior
Video output when recording or when being pulled from
/dev/video1
(webcamoid's output) stays 640x480, my webcam's default resolution, even if I change the resolution of the source before using the output. I did confirm that changing sources (to a video file) does change the output resolution, but when I re-open the webcam source it opens in 640x480 again, and the output gets locked back to that.Expected Behavior
Output should ideally change resolutions as the source resolution changes at any time, but at least when no output or recording is being done.
Steps to Reproduce
Suggestions and tips
This was previously fixed per the 8.5 patch notes as well as this bug report closed on 9.0 #379
Hopefully an easy fix. If I could force the webcam to open in a different resolution initially maybe I could get by, but I don't know how to do that.
Your Environment
warning: qrc:/Webcamoid/share/qml/VideoOutputPicture.qml:81:13: QML Image: Protocol "" is unknown
Looking in the file listed, I don't think it's related.
The text was updated successfully, but these errors were encountered: