-
-
Notifications
You must be signed in to change notification settings - Fork 123
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 for live streaming #7
Comments
It looks like the format has changed slightly - you now need to specify properties as: |
Hi garethx, Thanks for your response! May I ask where I could get the cloud_id? |
I adapted the basestation filter used in the Arm/Disarm example code to get the cloud id for the Arlo Q camera: You can then get the cloud id you need and pass it to stream, like so A working body example is: Which I pass to StartStream, and that looks like:
|
Thanks a lot! |
Sorry for the delayed response. Been super busy moving. I will try to test things out and respond tomorrow. |
So, got a chance to look into this issue a little deeper. The streaming protocol they use is rtmps (Real-time Messaging Protocol). I guess I never really tested this function... Streaming rtmps is kind of complicated and thus, will require a 3rd-party library (https://pypi.python.org/pypi/python-librtmp). All of the libs I have found so far rely on librtmp under the hood, which I have had trouble building on some of my machines. In order to keep things simple, I'm thinking I might just return the rtmps info you'll need to get the stream. And let the calling code use whatever library they want to actually do the streaming. If there's strong demand for this library to implement the rtmp streaming, please vote for it and I'll make it happen. |
I removed the StartStreaming() method and added a GetStreamUrl() method in it's place. See this commit: 26d80d5 I personally feel like this is a better solution because it allows you to use whatever streaming library you want. |
Thanks, Jeffrey! |
@rayhou0710 I was interested in doing some OpenCV object detection work on the Arlo videos, mainly to reduce the number of "false" alerts I get from Arlo. Would you be interested in collaborating or sharing the work you're doing? |
@jeffreydwalter Or course! I am planning to use Arlo on an interstate highway to detect trucks for my research project. I am trying to use yolo and SIFT to process images. I can definitely share the code with you once done. |
@jeffreydwalter By the way, may I ask how you reversed engineered the Arlo system? (Kind of silly question...) I took some classes on web and database before, but I am always under the impression that you can only get/post things using given urls. I don't know how you got all the fields, links, etc... I am super curious. I would appreciate if you could give some hints. |
Not a silly question at all. :) I used the inspector panel in Chrome to view all of the http requests that were being made by the browser when I clicked through all of the buttons on the arlo.netgear.com website. The browser inspector panel allows you to see all of the headers that are sent/received, along with the request/response body data, and urls. It is a tedious process, but not really all that difficult. |
Thanks for all the info on getting the streaming Url. I have successfully been able to interface this with my cameras. But I'm stumped on how to decode the RTMPS stream. As it's encrypted with an SSL certificate, do I need access to the certificate to decrypt? I haven't been able to decode the stream so far in any app :( |
So I was poking around in the Arlo APK for android, and found a wowza netgear.com certificate. Wondering if this is the key? |
I'm not really sure. I haven't had a need for streaming, so I haven't put
much time into getting it working. wowza is the media server netgear is
using, so it's possible that the certificate is what we need.
Here are the docs and source for the flowplayer plugin they are using:
http://flash.flowplayer.org/plugins/streaming/secure.html
…On Mon, May 1, 2017 at 12:52 AM, ryanwinter ***@***.***> wrote:
So I was poking around in the Arlo APK for android, and found a wowza
netgear.com certificate. Wondering if this is the key?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAinB6IHR5upXQT3CFZTLPLsL5PJA-S2ks5r1XMfgaJpZM4MP2Sz>
.
|
Poked around a little bit at the tag being created for the .swf player. Looks like they embed the "token" referenced in the flowplayer docs I pasted previously. It's in the flashvars parameter of the object element.
|
Yeah, I found this token as well. I'm trying to work out how to replicate the connection that flow player is using to the wowza service. I'll try checking out the wowza site and see if they have any docs. |
Luckily for us, it seems Netgear didn't really put much effort into securing their token. :) So, we have the url and token:
We just need to work out how to get the token from Python and what to do with these two to get the actual stream. |
@ryanwinter did you have any luck? |
hey @jeffreydwalter, I looked at this a bit but couldnt get anything to work. I used the ios user agent which generated a rtsp type link on port 443. I tried using ffmpeg and the rtsps protocol to connect but received a 404 error. A 404 seemed a positive step in that at least its generating a valid response, not sure if that was real or just a catchall. Was planning to add some more debugging to ffmpeg to see exactly whats going on. If the 404 is real, is could be that I am not passing the username/password in with the url or something. I plan to do a little more investigation but it's pretty slow going :D |
@ryanwinter how did you get the rtsp link? I tried changing '_web' in this call but no luck. 404 error could also be just dead url. 403 maybe if username/pass is problem. But I think going after iOS is the right approach. The flowplayer RTMPS extra handshake/encryption with built-in encryption is a problem. self.post('devices/startStream', {"to":device_id,"from":self.user_id+"_ios","resource":"cameras/"+device_id,"action":"set","publishResponse":True,"transId":self.genTransId(),"properties":{"activityState":"startUserStream","cameraId":device_id}}, 'StartStream', headers={"xcloudId":xcloud_id}) |
Any update on the significance of flashvars to make librtmp load the secure player plugin? |
@ryanwinter @jeffreydwalter Curious if either of you are working on this at all anymore. I have been playing around with getting the live stream to no avail as well. I think the key may be the link @jeffreydwalter posted above regarding the secureToken. I am thinking that the token we get in flashvars may be the shared secret from which we need to get the hash using some set of parameters to get the actual url for the stream. Unfortunatly I haven't found a way to sniff the actual rtmps stream so I am uncertain what url it is actual using. I am not sure if anyone else has any experience with this. I really hope we can get it working though and am happy to help in any way. |
I dove into the android apk and found these private key and certs. Perhaps someone can use them to start the connection? Hopefully this is helpful. |
Hey @njschwartz, thanks for your help with this! I spent a little time the other day dorking around with rtmpdump, but didn't have much luck. If I get some time one evening this week I'll spend a little more time playing around with the certs you sent. |
@jeffreydwalter Thanks a lot for looking. It isn't something crazy important, but it sure would be nice to be able to open the stream from a home automation dashboard instead of having to log into the app. I also tried rtmpdump and had zero luck...nothing I attempted got any output. I would think with the certs and keyfile it has to be doable, I just don't understand SSL well enough to do it myself. |
@njschwartz, didn't have time today, but check this link out. It does a pretty good job of explaining what all of the parameters are in the json that's embedded in the tag for the rtmps player in the Arlo website. It might be worth taking the values from the Arlo website and plugging them into the flowplayer just to see if it works. If it does, we might need to see if we can find the source to or reverse-engineer the flowplayer. After you log into arlo.netgear.com, you can download the two flowplayer plugins used by the arlo site here and here |
FYI, the JSON I'm talking about looks something like this:
|
@deanmcguire that is awesome. Nice work! So do you need to do anything else special to play that rtsps stream with ffmpeg? I thought I had tried that before with no luck but I may have had something off. Basically you just requested the iOS version of the stream and passed it to ffmpeg to play, that's it? I can't wait to test this... Thanks for sharing! |
@deanmcguire you're the man! Thank you for taking the time to figure that out. :) Would you be interested in making a PR? |
Nice @deanmcguire! Good deal to finally get a fresh start on this. |
@deanmcguire just tested things out. Works great! It looks like something changed between ffmpeg 3.2.2 and 3.4, because I was getting |
Just merged @deanmcguire 's latest commit, so streaming should now work! Thanks again! Currently, the library just provides the url for the stream and will do the pinging. You will still need to use ffmpeg or something similar to get the stream. Going to close this issue now, please file a new one if there are any problems. |
@deanmcguire do you mind sharing your HA/Appdeamon code? Just bought a pair of Arlo-cameras and want streamin to work in HA. I'm new to git, so don't know if you can contact me here but I've the same username at HA forums. |
I'm getting "Protocol not found" when trying to use ffmpeg for rtsps? |
@deanmcguire I’m on 3.4.1 and I’m getting the “protocol not supported”. When I had 3.2 it said “operation not permitted”. Initially I wanted to stream my arlo Q in HA and homekit, then I settled for just arm/disarm but even that’s too much of a work. Could you maybe help me how to reverse engineer the request I need to make? I’m a little bit new to the mitm-proxy thing but I do understand what you’re trying to extract and it does make sense. As soon as I understand how to extract the request I need to make I’m sure I could make Arlo Q supported too. Edit: I managed to install mitmproxy and used it a bit. Seems that I can't load the modes and thus see the request to arm/disarm the arlo Q. What are you guys using to extract the requests? |
@deanmcguire I’m using the command you posted above and that was commited. Thanks, I’ll use chrome instead...the mitx proxy didn’t reveal much but it was fun to set up and play with. I built it on pi3 and it’s basically a mitm-proxy acting like a router. Might have some fun with it later.. |
Just an update: I managed to arm/disarm the Arlo Q with my raspberry pi. I tested to pull the stream from my media server and it worked, I dowloaded a 3min long 1080p video. There is some miner changes to do for making it to work with arlo Q. I’m off for new year celebration but after the holidays I’ll can put up the changes for arlo Q. So I guess I'll have som fun with automating Arlo Q, my plan is to disarm/arm based on location..using Homekit rather than arlo's own app. Then record continuously to a local disk if it's trigger manually or by a motion. EDIT:
|
@Ritte88 would you mind contributing your arloq device schema from the GetDevices() call? I'm building a wiki page with all of the various Arlo hardware device schemas. I only have the first generation arlo cameras, so it's been tough to make the library make sense for all of the various Arlo camera/basestation combos, especially arloq and arlo go. Here's the wiki page, which includes a script you can use to generate the device schema with all of the sensitive values obscured. Thanks! |
@deanmcguire random question for you here... I just realized that the library is leaking Ping() reply messages, since Ping() calls Notify() and not NotifyAndGetResponse(). Since you're probably the heaviest user of the HandleEvents() method, I wanted to get your input about this issue. There are a couple of ways to handle things, but I'm on the fence. Calling NotifyAndGetResponse() inside of Ping() feels like the right thing todo since it's really sending a message to the event stream and a reply is sent in response.
There are a couple of issues with this approach.
So, my big question to you is... Do you foresee any need to handle Ping() reply events in your HandleEvents() callback? |
I ended up doing this 5956b1f I basically made HandleEvents() requeue any message with a resource type that starts with "subscription". I believe only subscribe and ping messages send that resource type. |
@deanmcguire do you happen to have any idea how the mobile app pauses live video streams? In the browser, it uses the flowplayer controls to pause/resume. It would be really nice to figure out a way to pause an ffmpeg stream. |
@deanmcguire I'm getting a weird error message when trying the command you posted above. tried this command too: might you know what I'm doing wrong? |
Check the version of ffmpeg you're running. I just tested on ffmpeg version 3.4.2 and it works fine. |
@jeffreydwalter Nevermind! Thanks! It was the quotes. |
ah, heh. I was looking at that, but thought nah... Glad you figured it out! |
It looks like Arlo has changed things since this topic was last visited. |
@jbusfield can you please provide some helpful details? The output of ffmpeg would be a good start. |
Users-MBP:Python jbusfield$ ffmpeg -re -i 'rtsps://vzwow18-z2-prod.ar.arlo.com:443/vzmodulelive/XXXXXXXXXX_XXXXXXXXXX?egressToken=XXXXXXXX_XXXX_XXXX_XXXX_XXXXXXXX&userAgent=iOS&cameraId=XXXXXXXXXX_XXXXXXXXXX' -t 10 -acodec copy -vcodec copy text.mp4 |
Are you using my library? I see your running that command by hand.
…On Fri, Mar 6, 2020, 2:34 PM jbusfield ***@***.***> wrote:
Users-MBP:Python jbusfield$ ffmpeg -re -i 'rtsps://
vzwow18-z2-prod.ar.arlo.com:443/vzmodulelive/4N71677KE6518_1583450458775?egressToken=XXXXXXXX_XXXX_XXXX_XXXX_XXXXXXXX&userAgent=iOS&cameraId=XXXXXXXXXX_XXXXXXXXXX'
-t 10 -acodec copy -vcodec copy text.mp4
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared
--enable-pthreads --enable-version3 --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl
--enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus
--enable-librubberband --enable-libsnappy --enable-libtesseract
--enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid
--enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r
--enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr
--enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[rtsp @ 0x7f8b8c00a400] method DESCRIBE failed: 403 Forbidden
rtsps://
vzwow18-z2-prod.ar.arlo.com:443/vzmodulelive/4N71677KE6518_1583450458775?egressToken=XXXXXXXX_XXXX_XXXX_XXXX_XXXXXXXX&userAgent=iOS&cameraId=XXXXXXXXXX_XXXXXXXXXX:
Server returned 403 Forbidden (access denied)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7?email_source=notifications&email_token=AAEKOB4YICJMSGTI6L6OEOLRGFM47A5CNFSM4DB7MSZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOCYTNQ#issuecomment-595954102>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEKOB4HVI33X5R7XDUVV7DRGFM47ANCNFSM4DB7MSZQ>
.
|
Yes I am using your library to run this code try:
except Exception as e: The code prints this out: I don't know why it cant run ffmpeg from code but rather than figure that out I instead copied and pasted the url into a command line ffmpeg |
What version of ffmpeg are you using? Also, try the ffmpeg command with |
ffmpeg version is 4.2.2 Using rtsp the output from ffmpeg is |
I have not found a solution for the issue |
do we get the solution for this ffmpeg code I am getting the same error: Invalid data found when processing input. it will be helpful if someone redirects me to somewhere else well if this is resolved. |
HI Jeffrey,
Thank you for sharing your elegant code. I have a question concerning the method StartStreaming as I am willing to integrate the live streaming of the cam with OpenCV for object detection. I get the exception of requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://arlo.netgear.com/hmsweb/users/devices/startStream. Do you have any idea about this? Also, as I see, the StartStreaming method return a generator. I am wondering if there is a way to return a frame Mat.
Thanks!
The following is part of my script:
body = {
"to":device_id,
"from":"300-XXXXXXXX_web",
"resource":"cameras/"+device_id,
"action":"set",
"publishResponse":"true",
"transId":transId,
"properties":{
"activityState":"startPositionStream"
}
}
stream = arlo.StartStream(body)
print(type(stream))
with open('name'+'.mp4', 'w') as f:
for chunk in stream:
f.write(chunk)
f.close()
The text was updated successfully, but these errors were encountered: