Open noelhibbard opened 3 years ago
I walked through the above steps, If I run the last command "python examples/streaming_video.py" I receive the following error:
Traceback (most recent call last):
File "examples/streaming_video.py", line 7, in <module>
from wyzecam import get_camera_list, get_user_info, login
ModuleNotFoundError: No module named 'wyzecam'
I am not too familiar with Python, how can I check that the wyzecam module exists?
If you followed all the steps (including the .
s), you should have the wyzecam module installed in the local venv which you can activate using the command source wyzetest/bin/activate
.
If that still doesn't work you can try reinstalling it from the repo using pip install .
(with the dot) or pip install wyzecam
on Ubuntu I had to make another slight edit to ensure the venv was using python3.8 which does work... all pip & python calls must be pip3.8 & python3.8
git clone https://github.com/kroo/wyzecam.git && cd wyzecam
sudo apt-get install python3.8 python3.8-pip python3.8-venv -y
python3.8 -m venv wyzetest source wyzetest/bin/activate
pip3.8 install . pip3.8 install requests pip3.8 install opencv-python pip3.8 install av
...
python3.8 examples/streaming_video.py
Hope this helps ...
@ricksdunn FYI, 'python' and 'pip' are linked to what ever version of python was used to create the venv.
So while in the venv, this:
python3.8 examples/streaming_video.py
Is the same as doing this:
python examples/streaming_video.py
@ricksdunn , thanks, I am running ubuntu 20.04; running with python3.8 did the trick.
On latest Ubuntu 20.04.2.0 LTS.
wyzetest) ron@ToshibaWin7-Ubuntu:~$ pip3 --version pip 20.0.2 from /home/ron/wyzetest/lib/python3.8/site-packages/pip (python 3.8)
(wyzetest) ron@ToshibaWin7-Ubuntu:~$ python --version Python 3.8.5
Got this far in above instructions...
git clone https://github.com/kroo/wyzecam.git && cd wyzecam
sudo apt-get install python3 python3-pip python3-venv -y
python3 -m venv wyzetest source wyzetest/bin/activate
pip install .
Then get this error:
(wyzetest) ron@ToshibaWin7-Ubuntu:~$ pip install . ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
Don't know if I am on the correct directory. Just ran these from my /home directory. What should I do next?
Note:
I tried to get slick and copy the setup.py file to the directory in which I was working.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
sudo apt-get install python3.8 python3.8-pip python3.8-venv -y
I'm on latest Ubuntu. When I try this, I get the following error:
(wyzetest) ron@ToshibaWin7-Ubuntu:~/wyzecam/wyzecam$ sudo apt-get install python3.8 python3.8-pip python3.8-venv -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.8-pip
E: Couldn't find any package by glob 'python3.8-pip'
E: Couldn't find any package by regex 'python3.8-pip'
Got past the errors. Going to try the example.
Got past the pip install error by making sure I used python3.8.
Now attempting example. Prepared to edit examples/streaming_video.py and totally stumped by this:
cam = [camera for camera in cameras if camera.nickname == "Back Yard Cam"][
0
]
What????
My camera name is simply WyzeCam301. Do I just replace the "0" with the camera name? And what happens when I add another camera? Sorry to be a bother, but this is a bit unclear.
Replace "Back Yard Cam" with the camera nickname you set in the wyze app.
Or if you simply want to get the first cam, just use:
cam = cameras[0]
Replace "Back Yard Cam" with the camera nickname you set in the wyze app.
Or if you simply want to get the first cam, just use:
cam = cameras[0]
Got it! Thank you!
I got a connection, but then python crashed!
(wyzetest) ron@ToshibaWin7-Ubuntu:~/wyzecam/wyzecam$ python3.8 examples/streaming_video.py 6, session_info = SInfoStruct: mode: 2 uid: b'45FX8Z1XY4M55RAP111A' remote_ip: b'192.168.1.211' remote_port: 191 tx_packet_count: 14 got av frame 23936 codec: 78 ts: 1624594040.507448 keyframe: 0 frame rate: 20 frame size: 0 bitrate: 120 qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ron/wyzecam/wyzecam/wyzetest/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
Aborted (core dumped)
OK, sorry everybody! I was ssh'd into my Ubuntu machine (I'm real old school). When I executed command from the machine terminal itself, boom, there I was in living color! Example works! Whoo-Hoo!
On to next leg of the journey!
Went through all the steps fine on both Ubuntu and MacOS, however am getting "validation errors for WyzeCredential access_token". I have verified credentials are correct in env vars. Also tried hard cording creds in streaming_video.py and got the same error. Any suggestions on what else to check?
$ python examples/streaming_video.py
Traceback (most recent call last):
File "examples/streaming_video.py", line 51, in <module>
main()
File "examples/streaming_video.py", line 16, in main
auth_info = login(os.environ["WYZE_EMAIL"], os.environ["WYZE_PASSWORD"])
File "/usr/local/src/wyze/wyzecam/wyzetest/lib/python3.8/site-packages/wyzecam/api.py", line 49, in login
return WyzeCredential.parse_obj(dict(resp.json(), phone_id=phone_id))
File "pydantic/main.py", line 578, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 3 validation errors for WyzeCredential
access_token
none is not an allowed value (type=type_error.none.not_allowed)
refresh_token
none is not an allowed value (type=type_error.none.not_allowed)
mfa_options
value is not a valid dict (type=type_error.dict)
@noelhibbard, Thank you so much for your post. Being green, there was no way i could have pulled this off with the basic instructions that were given. It worked for me with no issues. I would have been nice if they made a way for VLC to connect to it. VcXsrv Windows X Server, goes full screen which is kinda useless without being able to resize it.
@hobbez it looks like you likely have 2fa set up. See https://github.com/kroo/wyzecam/issues/57
@kroo - confirmed, thanks!
I would have been nice if they made a way for VLC to connect to it. VcXsrv Windows X Server, goes full screen which is kinda useless without being able to resize it.
Why don't you just pipe it directly to VLC?
with wyzecam.WyzeIOTC() as wyze_iotc:
with wyze_iotc.connect_and_auth(account, camera) as sess:
for (frame,_) in sess.recv_video_data():
sys.stdout.buffer.write(frame)
python myscript.py | VLC - --demux h264
I would have been nice if they made a way for VLC to connect to it. VcXsrv Windows X Server, goes full screen which is kinda useless without being able to resize it.
Why don't you just pipe it directly to VLC?
with wyzecam.WyzeIOTC() as wyze_iotc: with wyze_iotc.connect_and_auth(account, camera) as sess: for (frame,_) in sess.recv_video_data(): sys.stdout.buffer.write(frame)
python myscript.py | VLC - --demux h264
Because I know to little about Linux,, and know even less about Python. But I can copy and paste ;-) Thank you for the info though. I need to research more, as my goal now is to have a RPI board do this, and then (if possible) act as a streaming server so that on my PC I can use VLC to connect to the RPI board to receive the video feed.
did you try this pipe idea? Does it work?
I ended up using the fiveleaves hack and use cvlc ( command line binary ) of vlc and take the hack output and restream to rtsp locally
cvlc -vvv http://[cam IP]:12345 --sout '#rtp{sdp=rtsp://:8554/}' --demux h264 &
... my NVR then slurps up rtsp feed
... I will try this idea soon...
I would have been nice if they made a way for VLC to connect to it. VcXsrv Windows X Server, goes full screen which is kinda useless without being able to resize it.
Why don't you just pipe it directly to VLC?
with wyzecam.WyzeIOTC() as wyze_iotc: with wyze_iotc.connect_and_auth(account, camera) as sess: for (frame,_) in sess.recv_video_data(): sys.stdout.buffer.write(frame)
python myscript.py | VLC - --demux h264
Because I know to little about Linux,, and know even less about Python. But I can copy and paste ;-) Thank you for the info though. I need to research more, as my goal now is to have a RPI board do this, and then (if possible) act as a streaming server so that on my PC I can use VLC to connect to the RPI board to receive the video feed.
for (frame,_) in sess.recv_video_data():
sys.stdout.buffer.write(frame)
the conversion to stdout in terminal isn't working out to be able to use VLC to restream
I tried several adjustments in VLC and also piped to a file but the output was no good.. I am thinking the output needs to stay binary to be able to use it and sys.stdout.buffer.write(frame) examples do sys.stdout.buffer.write(b"frame") and that doesn't work either... I will also try the ffmpeg example to see if that can be piped into vlc to restream to rtsp w/o need for TinyCam or NgnX stuff
Okay, not really a question, just leaving some notes for really green Linux users.