Open abhilash-ingale opened 4 years ago
@abhilash-ingale may be you managed how to get a video feed?
Hi all, I have been working with this library from the last week and wish to manipulate my camera (PTZ) while streaming video from it simultaneously.
In separate processes, I could successfully move the camera using small nudges by modifying
continuous_move.py
in examples withsleep()
. But, I could not stream a video using the python-ONVIF client.Could anybody please help me to :
1. Get a video feed from my camera and 2. PTZ control the camera while it is streaming the video.
I will greatly appreciate any help.
Cheers, Abhilash
Hello Bro did you manage to run the PTZ Control? If yes could you share how did you do it?
Nope, but you could try multi-threading with Python (run the continuous_move.py and streaming code). Add the code in example if it works out.
` profile = media_service.GetProfiles()[0] request = ptz_service.create_type('GetConfigurationOptions') request.ConfigurationToken = profile.PTZConfiguration.token #= {'ConfigurationToken': profile.PTZConfiguration.token} ptz_configuration_options = ptz_service.GetConfigurationOptions(request) # request
move_request = ptz_service.create_type('ContinuousMove')
move_request.ProfileToken = profile.token
if move_request.Velocity is None:
move_request.Velocity = ptz_service.GetStatus({'ProfileToken': profile.token}).Position
move_request.Velocity.PanTilt.space = ptz_configuration_options.Spaces.ContinuousPanTiltVelocitySpace[0].URI
move_request.Velocity.Zoom.space = ptz_configuration_options.Spaces.ContinuousZoomVelocitySpace[0].URI
move_request.Velocity.Zoom.x = ptz_configuration_options.Spaces.ContinuousZoomVelocitySpace[0].XRange.Max
for i in range(10):
print(f"Zoom")
ptz_service.ContinuousMove(move_request)
move_request.ProfileToken = profile.token
# move_request.Velocity = {'PanTilt':{'x': 2.0, 'y': 2.0, 'Zoom': float(i)}}
move_request.Velocity.Zoom.x = 1 * float(i)
move_request.Timeout = 1
ptz_service.ContinuousMove(move_request)
# Wait a certain time
time.sleep(5)
# StopContinuous
ptz_service.Stop(profile.token)
print(move_request)`
Hi sir above is my code. I just one to try to perform zoom only. I've been trying to figure it out for weeks. I would like to try it with python but if it doesn't work maybe i have to try using c#.
Hi @MaarufB ,
As far as I remember, I had the PTZ movement working with the attached code.
Typing inputs like "ui" (and others) should navigate the camera. Take a look at the code it is super easy.
Also sharing this blog post that was super useful to me.
The bare minimum requirement is that your IP-Cam should support ONVIF protocol (check documentation of your particular cam). If it does, then adding proper login credentials (username, password, IP) to the code should do the trick. If it doesn't, you could look for special APIs from the camera manufacturer.
If there are further issues, I would be happy to help you out during the weekend. Also, as a personal request, if it works out for you, please get back here with the results.
Have fun & cheers, Abhilash
Code - PTZ_IPCam.txt
Hi @MaarufB ,
- As far as I remember, I had the PTZ movement working with the attached code.
- Typing inputs like "ui" (and others) should navigate the camera. Take a look at the code it is super easy.
- Also sharing this blog post that was super useful to me.
The bare minimum requirement is that your IP-Cam should support ONVIF protocol (check documentation of your particular cam). If it does, then adding proper login credentials (username, password, IP) to the code should do the trick. If it doesn't, you could look for special APIs from the camera manufacturer.
If there are further issues, I would be happy to help you out during the weekend. Also, as a personal request, if it works out for you, please get back here with the results.
Have fun & cheers, Abhilash
Code - PTZ_IPCam.txt
Thank you so much bro! Actually, I just finished reading the PTZ Service Docs on Onvif site. Our IP Camera has Onvif support but the Pan Tilt is not functioning even if I use the Main User Interface of our Cam Device only the zoom-in is working. I have tried to test the zoom -in functionality of our IP cam using the iSpy Software but it was built using C#, so I've decided that if I can't manage to operate using python I will use c#. I've been looking for an open-source with python so I found it. But I couldn't manage to make the zoom-in work for weeks. I am really glad that you are willing to help. I'll be back here soon. Thanks again @abhilash-ingale.
Hi all, I have been working with this library from the last week and wish to manipulate my camera (PTZ) while streaming video from it simultaneously.
In separate processes, I could successfully move the camera using small nudges by modifying
continuous_move.py
in examples withsleep()
. But, I could not stream a video using the python-ONVIF client.Could anybody please help me to :
**1. Get a video feed from my camera and
I will greatly appreciate any help.
Cheers, Abhilash