MV Video Clip Download

Solved
PhilipDAth
Kind of a big deal
Kind of a big deal

MV Video Clip Download

I'm working with a company in the entertainment industry where they provide rides.  They want to produce short 10s video clips of the customers as they pass a certain point in the ride.  They want to provide a web site where customers can go to after the ride and download that video and use as they see fit.

It should be automated and require no staff involvement.

 

I started having a play with this.  I used a webhook with motion detection and this gives me a still and a timestamp.  Perfect so far.

 

And then I came to a realisation - there is no API to download or export video - is there?

 

 

1 Accepted Solution
chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

That's correct Phil: this use case currently will require RTSP.

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem

View solution in original post

11 Replies 11
chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

That's correct Phil: this use case currently will require RTSP.

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem
theshmike
Getting noticed

@PhilipDAth  Well, in theory it IS possible to download the clips directly from the camera.

I did some reverse engineering for another project (you know what I am talking about :)) and I‘ve found out the following:

 

Video seems to be stored at the camera in smaller chunks of ~30 seconds (iirc).

When you do playback in the dashboard and your PC has a LAN connection to the camera, the browser loads these chunks directly from the camera with HTTPS. The browser is able to do this (despite same origin policy) because the camera registers in DNS with some kind of xyzdwviceid.devices.local.meraki.com (or similar, cannot remember, but you’ll get the pattern) and it‘s local LAN IP. It also has a corresponding SSL certificate that is issued by a Cisco CA.

Before the browser loads the video chunks, it receives some kind of metadata saying things like timestamp_from,timestamp_to,filename_at_camera“ - also from the camera (or maybe from the dashboard backend, but it doesn’t really matter) 

I found all the stuff by using a SSL proxy between my browser, the camera and the dashboard backend. I’m sure it‘s not a problem for you to reproduce that. 

But anyways, even if you would make it to be able to grab the chunks, you will run into the problem that you cannot take influence on when the chunks begin and when they end. If you need a time span that overlaps two chunks, you would have to do some ffmpeg stuff.

 

But if you have setup constant FPS, you can calculate the exact timestamp for each frame and get the result you‘re aiming for.

 

As I mentioned in another post. All this stuff is not official supported and it‘s quite a lot of work to get this done. I stopped working on a perl module for implementing all this to work automatically, because I don’t want to have wasted a lot of time if Meraki is going to change all the stuff or even protect against it in some future firmware versions.

theshmike
Getting noticed

@chengineer  err, just to be clear...did anyone delete my last post in this thread? 

chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

hey @theshmike, i see you reply from this morning at 5:08 PDT (UTC-7) in my inbox, but not here... i'm not sure what happened, and personally don't have the ability to delete posts (nor like that happening either)

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem
theshmike
Getting noticed

That‘s not cool! It took me 15 minutes to write the stuff down and the post was online here for more than an hour before it disappeared.

Is it some kind of „forbidden“ to publish reverse engineered stuff in here? I didn’t find anything about that in the community guidelines.

 

At least somebody should inform me if he or she  deletes a post of mine and tell me a reason...

 

update: @CarolineS  Haha, all right then...had the worst thoughts 🙂 

Thank you!!!

chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

Looks like @CarolineS fixed and restored your post from the spam filter, @theshmike! I'm not aware of any policy like that, and personally, we on the API PM team love our users tinkering and finding creative solutions! You already called out that it's not officially supported and subject to the MV device/firmware changing in the future. I'm not a lawyer, but other than that, I think that doesn't bar you from sharing cool info like this!

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem
theshmike
Getting noticed

@chengineer  awesome you‘re on the API team. Then please also recognize THIS thread: https://community.meraki.com/t5/Smart-Cameras/MV-API-rather-useless-for-mass-use-in-retail-analytics... 🙂

chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

Totally recognized, and it's something we've heard--loud and clear--for a while, both on the API & MV teams. While the API team doesn't own this feature, we are consulting with the MV team on possible ways to solve the problems you mentioned there. Another approach we've seen other partners develop use RTSP and local/custom models for edge processing, eliminating the reliance on any cloud APIs (Dashboard API or third-party computer vision engines).

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem
CarolineS
Community Manager
Community Manager

@theshmike - Sorry about that! Our automated spam filter is sometimes overly aggressive (But if we don’t have it turned on we get lots of junky spam posts). I have reinstated your post. 

Caroline S | Community Manager, Cisco Meraki
New to the community? Get started here
theshmike
Getting noticed

@PhilipDAthJust to back you up with some more details:

 

  • Cameras will register with a public DNS record like 192-168-10-10.macaddress.devices.meraki.direct and their local IP (192.168.10.10 in this case)

 

Do this to grab video chunks from the camera after you have double checked, that the camera is reachable via LAN and on-camera storage is enabled:

 

  • Get a valid dashboard session (API authentication doesn't work for this)
  • Call https://n#node#.meraki.com/#network_url#/n/#any_weird_id#/manage/nodes/new_list and parse it for all available video channels
    • #node# should be known
    • #network_url_alias# each network seems to have like a short url-compatible (readable) name. You can see this in the address bar of your browser if you're in the network
    • #any_weird_id# this is also some kind of sub id for the network (or whatever). You can also see it in your address bar. It seems that it's fixed and won't change
    • parsing pattern: stream2/http/channel/<channel_id>/... - is usually a number

 

 

The result will be something like

 

 

 

"start": 1595850970531,
"end": 1595851000381,
"length": 29.85,
"on_camera": true,
"storage_provider": "on_camera",
"expiry": 1595851698902,
"src": "https://192-168-10-10.<macaddress>.devices.meraki.direct/video/20a52333c7473da282ad712fdb8fdb59/1595850970.531.mp4",
"width": 1920,
"height": 1080,
"size": 11689724

 

 

 

There you go, now you can download the video chunk from

https://192-168-10-10.<macaddress>.devices.meraki.direct/video/20a52333c7473da282ad712fdb8fdb59/1595850970.531.mp4

 

PhilipDAth
Kind of a big deal
Kind of a big deal

Wow @theshmike .  What an impressive effort!

Get notified when there are additional replies to this discussion.