-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
API call to add monitor resports missing Name and OutputCodec parameters #3341
Comments
Thanks for opening your first issue here! Just a reminder, this forum is for Bug Reports only. Be sure to follow the issue template! |
I modified the log volumes in my dockerfile, which I think made some permissions errors, so not all logs were showing. Fixed that, and I found this:
I think there are a couple of issues with error messaging and validation -- the error message implies that "H264" would be a valid value, but in fact it looks like lower case "h264" makes it past validation -- but then, it dies at the database level for not being an integer representative of (what i'm assuming is) an enum. |
oh wait, actually that error log doesn't show up in the tailed logs, because of the filename! Had to exec into the docker container to see it. |
I hacked together a solution by editing api/app/Model/Monitor.php and commenting out OutputCodec from the "actsAs" section, guessing that would bypass validation, and allow me to pass 0 directly back to the db. which worked! Someone who knows better probably figure out an actual fix. I know zero php. :P |
Unfortunately the OutputCodec is actually an integer not an enumeration. These values actually come from the ffmpeg libraries. I think the right and friendly thing to do here is detect and auto-convert h264 to 27 in the api. Looks like the api may just be out of date. I'll try to look further today. |
@connortechnology oooh wow. ok, that's interesting. Yeah there's definitely a bug in that there doesn't seem to be a way to get a valid value in there, due to the validation bug, but totally not obvious that it's not or shouldn't be an enum. You're right, probably at the api level converting the string (preferably ignoring case) to the integer value that ffmpeg expects. |
Seeing the same issue, unable to create cameras via the API. Commenting out this fixes the issue. I tried replacing with something like:
but I still received some errors (will try to debug more later). |
Has anyone got an solution for this issue ? |
@seemantsharma001 Way back when, I made a fork of zmdockerfiles, and had the Dockerfile patch the Monitor.php in a really hamfisted way, basically commenting out the 'OutputCodec' line. I believe @connortechnology above in this thread found the same "solution". The commit is here, but I stopped using zoneminder shortly after, so almost certainly you'd need to re-apply the logic in your own environment. |
Hi @aou I installed zoneminder on raspberry pi and didn't find the path api/app/Model/Monitor.php , can you please help? |
looks like it's here Is it a docker install or from package manager? If from package manager, you need to see where the files are installed and edit there. If running from docker, you'd have to do something like what I did, edit the docker file to patch as appropriate. Or I guess you could also |
.disk/ etc/ media/ root/ srv/ var/ These are the directories and I am not sure in which the zm in installed, any help? sorry to bother you but I am new to zm and rpi |
sorry i'm not sure from the description how the app is installed / running. If it's on a debian-based system and you installed via package manager, you can try |
Might be good to try this out on something other than the raspberry pi to start, so you can get familiar with the mechanics of running a modified codebase. |
@aou your logic helped and its working like magic. Thanks a lot |
Hello!
Describe Your Environment
Describe the bug
Trying to add a monitor with the API results in messages about missing Name and OutputCodec parameters:
To Reproduce
Steps to reproduce the behavior:
this request was made with python, have tried a couple of different values for OutputCodec, like 0, '0', 'H264'
Interestingly, making the same request with the pyzm module results in a slightly different error, where the Name parameter seems to be filled, but OutputCodec still missing
Expected behavior
A clear and concise description of what you expected to happen.
Debug Logs
Nothing shows up in the logs for me when I make the API call.
The text was updated successfully, but these errors were encountered: