-
Notifications
You must be signed in to change notification settings - Fork 156
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
Make resolution/frame rate controllable via ONVIF #157
base: master
Are you sure you want to change the base?
Conversation
- persist in videoencoderconfiguration - restart server if necessary (kernel blocks access when streaming?) - remove unsupported profile selection and allow quality 0,1 for vbr/cbr
lib/camera.ts
Outdated
v4l2ctl.ApplyControls(); | ||
|
||
if (this.config.RTSPServer === 1) { | ||
// If it's our RTSPServer, we should have sufficient access to change resolution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think looking at how it's launched this is probably not true, but I haven't actually tested it.
Many thanks for this. |
@@ -16,7 +22,6 @@ class Camera { | |||
{ Width: 1024, Height: 768 }, | |||
{ Width: 1280, Height: 1024 }, | |||
{ Width: 1280, Height: 720 }, | |||
{ Width: 1640, Height: 1232 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my Camera 2.1 module this resolution was causing issues. I believe it's because the height is greater than 1080.
@@ -102,11 +109,6 @@ class Camera { | |||
utils.cleanup(() => { | |||
this.stopRtsp(); | |||
var stop = new Date().getTime() + 2000; | |||
while (new Date().getTime() < stop) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is only necessary because of the driver unload below, which was commented out. I think it's a good idea not to get involved with module loading/unloading and leave this to the user if necessary.
Previously, some camera settings were persisted in v4l2ctl.json, but others were not (either overwritten by subsequent actions or never there in the first place). This tries to make sure there's only one place we're storing settings, and then makes sure to save them all. The signal-exit package is introduced to more reliably handle exit cleanups, which is now more important if the user has just changed a setting (save runs on a 30 sec delay). Also re-introduce H264 profile handling.
The resolution/frame rate is not controllable with wryun repo. |
We're using this code now and it seems to work for us with the v4l2rtspserver backend. If you could explain how it's not working, I might be able to help. Make sure you're on the correct branch, not the master branch. |
Hi wryun, |
I have tried RaspiOS Buster. Same situation. Cannot set resolution and frame rate via ONVIF |
@universe241981 all I can say is it works assuming you're using v4l2rtspserver. Are you sure you checked out the right branch from that repository? |
@wryun please correct me if I am wrong. I am using bullseye. This time, I found error message below: /home/pi/rpos/node_modules/signal-exit/dist/cjs/index.js:162 SyntaxError: Unexpected token '.' |
Looks like you're using an old version of NodeJS that doesn't support ?. (this problem is in a dependency rather than in the code itself) Looking at the dependency, this is probably my fault; try upgrading to a later version of NodeJS (or potentially downgrading signal-exit). |
You are right. The installation instruction in the README is NodeJS version 12. While this branch can use version up to 16 only. Version 18 onward will have error below at "npx gulp":
and leaded to error below if execute "node rpos.js":
Anyway, the resolution/fps is controllable via ONVIF with this branch and with NodeJS 16. By the way, I also implemented the timestamp overlay function from "www.linux-projects.org"...with some hardcode on the ".json" file. But unfortunately I cannot utilize the rpos.service for it to start up at boot. As work around, I put the "node rpos.js" command in the .bashrc file and it work with some message:
|
The restart logic here is particularly messy/ugly; it's just what we needed. Not sure if I'm going to have time to make it a bit nicer, but thought I'd leave the PR here in case anyone's interested in what needs to be done for #63