Help with custom header

Previous development branch now released as 1.36
Locked
wes93
Posts: 6
Joined: Sat Apr 10, 2021 11:49 pm

Help with custom header

Post by wes93 »

Hello to everyone :-D
i'm new to zoneminder and i can't find a way to access my camera stream :-(.
I know that the address (tested with ffmpeg and ffplay) is this: http://192.168.0.136/livestream/11 but the problem is that works only if i pass this custom header: -headers "Authorization: Basic YWRtaW46" , if i pass user:pass@ip won't work... :-(
The full ffplay command that works well is: ffplay -headers "Authorization: Basic YWRtaW46" -i "http://192.168.0.136/livestream/11"
How could i pass this custom header to my source?

Thanks a lot
Stefano
bbunge
Posts: 2923
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Help with custom header

Post by bbunge »

Usually if you have the stream right and the cam doesn't work it is the resolution you enter in Zoneminder. VLC is a great tool to prove if a cam will work in Zoneminder. To see the resolution you need to use: VLC (Tools, Media Information, Codec) to check camera Display Resolution.
You can also halve the listed resolution to lower the load on the server.
wes93
Posts: 6
Joined: Sat Apr 10, 2021 11:49 pm

Re: Help with custom header

Post by wes93 »

Thanks a lot for your reply :-D
Unfortunately the problem is that without the custom header authorization i have a 403 unahutorized error :-(

The log:
Unable to open input http://admin:@192.168.0.50/livestream/1 ... audio_data due to: Server returned 401 Unauthorized (authorization failed)

The problem is that i need to pass the custom header instead of admin:pass

So i can't find where i need to put the custom header... :-(
LINK : http://192.168.0.50/livestream/11?actio ... audio_data
ADD FLAG : -headers "Authorization: Basic YWRtaW46"

Using this FLAG i could see the image via ffplay

Again thanks a lot
Stefano
gbruneau
Posts: 15
Joined: Fri Jun 07, 2019 8:27 pm

Re: Help with custom header

Post by gbruneau »

Did you remove the password for posting in the forum? Just checking because it looks like you might have just missed that bit.

Try this, but update password to the real password. You may have done this already but it’s not clear.
http://admin:password@192.168.0.50/live ... audio_data
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Help with custom header

Post by Magic919 »

The OP is saying that putting the username and password in the URL does not work. He wants to use an HTTP connection and pass the credentials in the headers, like you’d do with an API.

Unless it can be done as part of the FFMPEG command, I can’t see how this would happen in ZM without a code change.
-
User avatar
makers_mark
Posts: 18
Joined: Sun Jul 05, 2020 7:23 pm

Re: Help with custom header

Post by makers_mark »

wes93 wrote: Wed Apr 28, 2021 8:48 am Hello to everyone :-D
i'm new to zoneminder and i can't find a way to access my camera stream :-(.
I know that the address (tested with ffmpeg and ffplay) is this: http://192.168.0.136/livestream/11 but the problem is that works only if i pass this custom header: -headers "Authorization: Basic YWRtaW46" , if i pass user:pass@ip won't work... :-(
The full ffplay command that works well is: ffplay -headers "Authorization: Basic YWRtaW46" -i "http://192.168.0.136/livestream/11"
How could i pass this custom header to my source?

Thanks a lot
Stefano
In the 'Source" tab for that monitor under 'Options', have you tried putting:

Code: Select all

headers="Authorization: Basic YWRtaW46"
wes93
Posts: 6
Joined: Sat Apr 10, 2021 11:49 pm

Re: Help with custom header

Post by wes93 »

Thanks a lot for everyone for the help,
@gbruneau, the camera has no password, just the admin and Infact works with custom header

@makers_mark
Unfortunately won't work:

Unable to open input http://@192.168.0.50/livestream/11?acti ... audio_data due to: Server returned 401 Unauthorized (authorization failed)

@Magic919
So you think the only solution it’s hope in a code update?

Best regards
Stefano
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Help with custom header

Post by Magic919 »

I don't expect it'll happen unless there is a demand for it and some funding. It's not a common use case.
-
wes93
Posts: 6
Joined: Sat Apr 10, 2021 11:49 pm

Re: Help with custom header

Post by wes93 »

@Magic919
Ok thanks a lot for your reply and your time.
I love zoneminder and the app... :-(
Should you know some other app or suggestion?

Best Regards
Stefano
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Help with custom header

Post by Magic919 »

I don't, sorry.

You could ask on the Slack channel, someone might have experience.
-
wes93
Posts: 6
Joined: Sat Apr 10, 2021 11:49 pm

Re: Help with custom header

Post by wes93 »

OK thanks i could try :-D
Locked