Help with custom header

Forum for questions and support relating to 1.35.x development only.
Post Reply
wes93
Posts: 6
Joined: Sat Apr 10, 2021 11:49 pm

Help with custom header

Post by wes93 » 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

bbunge
Posts: 2734
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Help with custom header

Post by bbunge » Thu Apr 29, 2021 1:28 am

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 » Thu Apr 29, 2021 10:46 am

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 » Sat May 01, 2021 4:08 am

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: 488
Joined: Wed Sep 18, 2013 6:56 am

Re: Help with custom header

Post by Magic919 » Sat May 01, 2021 5:41 am

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: 2
Joined: Sun Jul 05, 2020 7:23 pm

Re: Help with custom header

Post by makers_mark » Sun May 02, 2021 3:02 am

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 » Mon May 03, 2021 8:15 pm

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: 488
Joined: Wed Sep 18, 2013 6:56 am

Re: Help with custom header

Post by Magic919 » Tue May 04, 2021 9:48 am

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 » Tue May 04, 2021 9:54 am

@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: 488
Joined: Wed Sep 18, 2013 6:56 am

Re: Help with custom header

Post by Magic919 » Tue May 04, 2021 12:19 pm

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 » Tue May 04, 2021 12:22 pm

OK thanks i could try :-D

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest