jdillenkofer / camera_proxy

MIT License
45 stars 17 forks source link

feature request #6

Open surfzoid opened 3 years ago

surfzoid commented 3 years ago

Hello, i have 2 argus2 cam at work and would like to see camera stream at home with my linux rpm based distro, mageia. if am i understant your application only use local, could you add an option who use web conection (throug amazon p2p stream). I also would like to save motion detection on an local pc with ftp or samba rather save on reolink cloud. i'm trying at home but seem to don't get anything or perhap's i didn't do it in the right way :

python3 ./src/main.py --debug 'backupImage': '../public/images/klingel.jpg'}]}

the 404 message came when i opened the http page with my browser

thank for your good work

jdillenkofer commented 3 years ago

Hi, your request is wrong. Try to send a get request to "/api/v1/cameras/Argus2b". That should work.

Regarding the p2p stream and the sambda recording. I don't have enough information on the protocol yet to get something like this to work. So no promises. But i would like to have such a local recording feature too.

surfzoid commented 3 years ago

Thank for your response, for the two cam, argus2a and argus2b i get an infinite "INFO:baichuan_udp_layer:Sending discovery packet" and one time INFO:werkzeug:127.0.0.1 - - [23/Nov/2020 17:15:48] "GET /api/v1/cameras/Argus2b HTTP/1.1" 200 - and INFO:main:Stopping camera stream Argus2 but only your "klingel" picture :-) pherap's because i'm not localy, i'm at home and cam are at work.

jdillenkofer commented 3 years ago

Yes, the discovery packet is send to the broadcast ip 255.255.255.255. This can only work, if you are in the same network as the camera.

surfzoid commented 3 years ago

if i want test and in the future ad this as an option, which broadcast ip i should use 255.255.255.254 ? only change in udp layer file?

jdillenkofer commented 3 years ago

From wikipedia:

A special definition exists for the IP address 255.255.255.255. It is the broadcast address of the zero network or 0.0.0.0, which in Internet Protocol standards stands for this network, i.e. the local network. Transmission to this address is limited by definition, in that it is never forwarded by the routers connecting the local network to other networks.

This program currently only supports the local network access to the camera.

surfzoid commented 3 years ago

Yes, you confirm Wath i understood, so, is it "easy" to add an option to use local or internet network, with wireshark i saw few ip, one seem the reolink author server and other aws cloud server, so somewhere we could say to the Cam to directly send the stream rather pass through aws server

surfzoid commented 3 years ago

Hi i'am at work, that's ok, except i need to disable my firewall, i tryied to add 2015/udp and 8000/tcp but doesn't work which rules i need? thank

surfzoid commented 3 years ago

Hi to be clear, here it is my config, at work an 4g router with one PC, let's say PCW and 2 Argus 2 cam, at home one box (freebox) with openvpn server inside. At first, i connected the PCW with openvpn routed, considering it is less exposed, but as we know, it isn't possible to brodcast, also, from shh, if i try your program, because of vpn, broadcast don't work too, then i tried openvpn bridge mod, with ssh i got this NFO:baichuan_udp_layer:Sending discovery packet INFO:baichuan_udp_layer:Received discovery packet answer from ## INFOcameraSending legacy login packet INFOcameraReceiving nonce packet

here the program hang

so to keep routed vpn, it is possible to add ip of the cam in the config file and have an option like -b or --nobroadcast to use uuid or directly ip ?

I noticed too, the video don't have sound and was an MJpeg (motion), so under linux vlc can't read it, gst can, but, is there performance issue, another switch should be nice to select low or hig video quality mod.

Thank to take time to read me.

goldenhub77 commented 3 years ago

@jdillenkofer I am getting video, but noticed no audio coming through from the Argus 2. Is there anything special that is required to get the audio stream?

surfzoid commented 3 years ago

@jdillenkofer I am getting video, but noticed no audio coming through from the Argus 2. Is there anything special that is required to get the audio stream?

Same for me,

Lanwalker commented 3 years ago

Is the audio turned on at the cameras ?

Robert Gamble Rfgamble@yahoo.com (preferred ) Rfgamble@hotmail.com Robert.gamble0@gmail.com Robertfgamble@att.net

On Monday, November 30, 2020, 4:25:05 PM EST, surfzoid notifications@github.com wrote:

   @jdillenkofer I am getting video, but noticed no audio coming through from the Argus 2. Is there anything special that is required to get the audio stream?

Same for me,

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

goldenhub77 commented 3 years ago

@Lanwalker Yes the audio is turned on and streams via the app but not via the proxy.

Lanwalker commented 3 years ago

Just making sure. I did that when I first started working with the Reolink app. Good luck.

Robert Gamble Rfgamble@yahoo.com (preferred ) Rfgamble@hotmail.com Robert.gamble0@gmail.com Robertfgamble@att.net

On Monday, November 30, 2020, 7:58:43 PM EST, Golden notifications@github.com wrote:

@Lanwalker Yes the audio is turned on and streams via the app but not via the proxy.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

surfzoid commented 3 years ago

You are right @Lanwalker, with the official app, by défaut sound is mute, but if i'm remember corectly, the choice of recording sound is in setup, so the mute option is only in the client, not in the Cam ?

surfzoid commented 3 years ago

Other part, if we look at the code, this is pyav h264, viewer of stream say Mjpeg (motion) or jpeg vidéo

jdillenkofer commented 3 years ago

Yes, i only decode the video stream. There are also audio packets but currently the camera proxy just drops these packets.

goldenhub77 commented 3 years ago

@jdillenkofer Is this on purpose or do you have plans to decode the audio?

jdillenkofer commented 3 years ago

@surfzoid The port the camera sends its packets to is choosen randomly by the camera proxy and transferred to the camera via the discovery broadcast. I don't know any way how a direct communication to the camera could work without the broadcast.

There is also currently no way to set a fixed port, but that can be easily implemented. Feel free to send me a pullrequest.

@goldenhub77 I didn't need the audio support for my use case and i currently don't have any plans to implement it. But i am not against it and if someone creates a pull request that works, i can merge it.

goldenhub77 commented 3 years ago

@jdillenkofer Will do, thank you for the quick reply. Do you have any additional documentation you can share that would assist as I'm going to try to work on the audio?

jdillenkofer commented 3 years ago

@goldenhub77 I only have this link, which explains how the BAICHUAN_MESSAGE_ID_VIDEO can be split into video frames (P and I-Frames) and audio frames (AAC-Frames).

The AAC_FRAME in this file should contain the audio stream. I don't know if you also need some kind of metadata like sample rate to decode this audio stream.

And i also don't know how we can transport the video and audio stream to the consumer. I currently only use a stream of jpeg images. Maybe we can change the "/api/v1/cameras/[camera]/stream" endpoint somehow to support the html5 video tag.

surfzoid commented 3 years ago

I saw yesterday this part of frame def as Jpeg, this is where to investigate ? Could you please comment your code ?

surfzoid commented 3 years ago

@surfzoid The port the camera sends its packets to is choosen randomly by the camera proxy and transferred to the camera via the discovery broadcast. I don't know any way how a direct communication to the camera could work without the broadcast.

There is also currently no way to set a fixed port, but that can be easily implemented. Feel free to send me a pullrequest.

Damed smartphone ! 😁 For the port, 10 years ago i was abble, to do it in csharp, but i loose practice and don't know enought python, also, i start to be old :-)

surfzoid commented 3 years ago

@jdillenkofer somewhere, you say you have some freez of image, in the official client we have option to switch beetween hight or medium video quality, in the link you provide here, we can see the definition of the résolution and fps, this can be add as an option, perhaps also use other codec suported by the Cam. I see also country def in the frame, is there an logic with fps? Sound like when, the codec is define to h264, the Cam send an stream in h264, why convert in Mjpeg ? We should try Google Web codec.