JurajNyiri / pytapo

Python library for communication with Tapo Cameras
MIT License
277 stars 58 forks source link

Added a check to make sure ffmpeg is installed before processing media streams #115

Open nikitiuk0 opened 4 months ago

nikitiuk0 commented 4 months ago

I was getting a quite annoying error inside an infinite loop about ffprobe. I am not very familiar with ffmpeg tool, so it took me a couple of hours to realize that I didn't have ffmpeg on my laptop. This check should clarify the problem before trying to parse media stream.

...
Downloading ./videos/2024-05-13 05_03_30-2024-05-13 05_04_46.mp4...
[Errno 2] No such file or directory: 'ffprobe'
Warning: Could not calculate length from stream.
Downloading ./videos/2024-05-13 05_03_30-2024-05-13 05_04_46.mp4...
[Errno 2] No such file or directory: 'ffprobe'
Warning: Could not calculate length from stream.
Downloading ./videos/2024-05-13 05_03_30-2024-05-13 05_04_46.mp4...
[Errno 2] No such file or directory: 'ffprobe'
Warning: Could not calculate length from stream.
...

It will return the following error with this check if ffmpeg is not installed:

Traceback (most recent call last):
...
  File "/Users/.../pytapo/media_stream/downloader.py", line 110, in download
    convert = Convert()
              ^^^^^^^^^
  File "/Users/.../pytapo/media_stream/convert.py", line 21, in __init__
    raise Exception('ffmpeg is not installed')
Exception: ffmpeg is not installed