Morning all.
This has come up several times, and, prompted by a colleague, I went to investigate how to dewarp a 180 degree RTSP stream from a Meraki MV Camera
You're going to need two pieces of software. FFMPEG and FFPLAY
Firstly, there is no warranty, implied or otherwise here. FFMPEG is used at your own risk, and this is the suggestion of an engineer who needed a Proof of Concept. Nothing else
I'm going to do this on macOS, rather than windows!
So, firstly, download FFMPEG and FFPLAY from https://www.ffmpeg.org/
Secondly, go to Meraki Dashboard, Cameras, Cameras, select your camera (MV33 in my case), then Settings. Enable RTSP and get the URL. In should be in the format of rtsp://192.168.128.1:9000/live for example
Okay, let's first test that we can play the stream
Open up Terminal, navigate to where you've downloaded FFMPEG and FFPLAY
Type:
./ffplay -rtsp_transport tcp -t rtsp://192.168.128.163:9000/live
After a lot of text, it should spawn a new window and show you your stream:
If you've got this far, you've done the hard work. You can close the video window, which will terminate FFPLAY
Now, we need to do two things. The first is to dewarp. We are going to use FFMPEG for this
./ffmpeg -rtsp_transport tcp -i rtsp://192.168.128.163:9000/live -vf "v360=fisheye:output=c1x6:ih_fov=180:iv_fov=180:pitch=-90"
There's a lot to unpack here. We use FOC=180 because this is a fisheye, NOT a 360 camera. Pitch rotates the image too, if need be, depending on your view point
Now, we need to send the video stream, dwarfed, to FFPLAY
./ffmpeg -rtsp_transport tcp -i rtsp://192.168.128.163:9000/live -vf "v360=fisheye:output=c1x6:ih_fov=180:iv_fov=180:pitch=-90" -f matroska - | ./ffplay -
-f is format, and we chose the matroska format. We then pipe this to ffplay
Run this command
(I've only grabbed part of this image because it's 1056x6336 resolution
Now, the hard part. We can use a parameter in FFPLAY to both crop and rotate the image if need be
I'm going to chose the middle part of the image above and rotate:
./ffmpeg -rtsp_transport tcp -i rtsp://192.168.128.163:9000/live -vf "v360=fisheye:output=c1x6:ih_fov=180:iv_fov=180:pitch=-90" -f matroska - | ./ffplay - -vf crop=800:800:1600:800,transpose=1
-vf crop=800:800:1600:800 takes the image at 1600:800 and creates a 800x800 image from there
using the transpose=1 rotates it 90 degrees clockwise with no flip we get
Now, this is not the central part of the original image, it's actually the left hand side, but it's dewarped!
The difficult part ahead of you now is understanding which part of the image it is you want to see using
vf crop=800:800:1600:800
You'll only need to change the last two parameters to experiment
Hope that's been useful!