Amcrest IP Camera Component Enhancements - PTZ control and audio streaming

That’s weird. The way I read the code, with the errors you’ve shown, then this error should be in the log, too. Hmm.

“Off” doesn’t mean unpowered. It means the video output stream has been disabled. New in 0.92.0 is the ability to turn Amcrest cameras “on” and “off” (via the camera.turn_on and camera.turn_off services.) Also, the state of the camera entity should show the on/off status – if the state is idle that means the video output stream has been disabled (either via the camera.turn_off service, or possibly by directly changing camera settings via some other means.) If the video output stream is enabled then the camera’s state should be streaming or recording.

Having said that, there are actually multiple video output streams that can be individually enabled or disabled. (I.e., Main Stream, Sub Stream, etc.) The amcrest component will enable or disable all of them when camera.turn_on or camera.turn_off is used. You might want to try calling camera.turn_off followed by camera.turn_on and see if that makes any difference.

The Sub Stream is simply channel 1, whereas the Main Stream is channel 0 (at least regarding the snapshot command.) They are both accessed via the same host & port settings.

BTW, is HA accessing this camera directly (i.e., is 999.999.9.9:80 its address), or are you trying to get at it via an NVR?

Hmm, then I don’t understand why you’re seeing so many retries and errors. Is something else accessing this camera at the same time HA is?

@TheLaw

So, I’ve only used resolution: high, so I just assumed the code that was already there for dealing with snapshots when resolution: low was selected worked as it should.

Turns out the channel number in the snapshot command does not select Main Stream vs Sub Stream. I tried the raw commands using both channel numbers (0 and 1) and they both output the same size image. (On the camera I tested this on the Main Stream is configured as 2304x1296, whereas the Sub Stream is configured as 640x480. So if the snapshot’s channel number selected between these streams, then channel=1 should have produced a much smaller image. In both cases I got images that were 2304x1296.) So looks like I have one more change to add to the list!

Getting back to your situation, the snapshot will be attempting to grab an image based on the Main Stream configuration (or, at least, that’s the best I can figure out.) Maybe you need to make sure that configuration is reasonable. FWIW, here is how I have both streams configured (on my IP3M-943W):

My setup looks very similar, my mainstream is set to 4k. Oddly enough, this issue only started to occur after I added the second camera. The first camera snapshot is now randomly working again. Second is not. I have both cameras recording motion to the local SD card, but nothing besides that. They have identical settings (aside from network). They’re both being accessed directly, no NVR.

Hmm, not sure what to say. I also have two Amcrest cameras (the IP3M-943W I mentioned above, and an IP2M-841W.) I often have them both recording to internal SD card. I’ll try them both now, with both recording, on 0.92.0 and let you know if I can duplicate what you’re seeing.

EDIT: I might also mention HA is accessing both of these cameras via WiFi.

Sounds good, I’ll grab a screenshot of my settings later today.

Seems to work fine for me. I even set resolution: low on one of the cameras. Then I tried again with stream: removed from my config, so that when I click on a thumbnail and it brings up the “more info” window, it updates via snapshots instead of live streaming. Even that worked fine. I’m not seeing any warnings or errors.

Snapshot resolution is specified via the snapshot tab under the camera’s video settings. You can have a different resolution for general snapshots or events. Snapshot resolution is not selectable by any http cgi commands that I have seen. I also did not find any command in the API guide to dynamically reconfigure snapshot resolution.

Specifying a subtype stream for a snapshot is ignored. Specifying channel 0 or 1 or even no channel results in the same snapshot. Channel #'s greater than 1 are relevant for connection to an NVR only.

Thanks. It’s been a while since I initially configured these cameras I forgot about that! :slight_smile:

But, looks like it only shows the Image Size. Doesn’t look like you can change it. You can only change the Quality (which I assume affects the size of the resulting file, but not its pixel resolution. I.e., it affects compression.)

@TheLaw @GaryOkie

Bingo! I just upped the Quality setting on both cameras to the highest value (6.) Although the snapshots still work on the IP2M-841W (which is 1080P, aka 1920x1080), I started getting errors on the IP3M-943W (which is 2304x1296.)

oh heck, you’re right - it’s grayed out and can’t be changed here either. So the bottom line is snapshot resolution is hardcoded in each camera?

I suppose if you really needed a lower resolution or cropped image, the camera proxy component should suffice. I use this component now to zoom in on a particular area of interest and HA sends me a text of this smaller image if a “security event” occurs.

EDIT: sent my post before seeing that you found Quality impacts resolution. Nice find!

Well, like I said, it doesn’t affect resolution, but does affect compression, which affects “file” size.

I’m experimenting with the retry and timeout parameters of the requests session, and the timeout of the actual command, to see if I can find a combination that works. Right now (without messing with those) the highest Quality setting that works (on the higher resolution camera) is 5. As soon as I go to 6 it fails.

@pnbruckner @GaryOkie

Good find! I know my snapshot settings are set to max. Will test tonight, sounds like a good temp fix.

So if I set the connection timeout to 5 sec, and the read timeout to 15 sec, with Quality set to 6, I get error 401. But if I up the read timeout to 20 sec, the error changes to “… 500 Server Error: Internal Server Error …”

With Quality set to 5 on this camera, I’m getting a file size of just under 700K. Based on what I’ve seen I think the size goes above 1M if I set the Quality to 6. I’m guessing the camera firmware just can’t handle a file size that big. Or at least it can’t with the way the code is asking for it. I’ll experiment a bit more.

But, yes, sounds like for higher resolution cameras the snapshot quality needs to be lowered, at least as a temporary work around.

Set to 4 and working perfectly, thank you!

1 Like

Need more help sorry:( I installed the latest of Amcrest for Github. It was working prefectly till I believe a upgrade maybe? Now it doesnt work at all. HA doesnt register go_to_preset as a recognized command anymore.

HA does see amcrest camera. It can do live view of it. However I am unable to change preset via go_to_preset.

Error while executing automation automation.camera_wall. Service not found for call_service at pos 1: (ServiceNotFound(…), ‘Service camera.amcrest_goto_preset not found’)

Have you installed the latest, version 1.3.3? If not, install it and let me know how that works for you.

I’m using this one. Is this Correct?

That is my custom amcrest component. But the question is, what version do you have installed? Look for a line like this in __init__.py:

__version__ = '1.3.3'

Yes I have 1.3.3 installed.

It was working prefect a few days ago. Now nothing

What version of HA are you using? Do you see any warning messages about using a custom component or integration for amcrest? Are there any other related warnings or errors in the log? What does your amcrest configuration look like?