danielcardeenas / whatsapp-framework

⚗️Whatsapp python api
1.16k stars 363 forks source link

Error in video send #61

Open saade opened 6 years ago

saade commented 6 years ago
Error occured at transfer 'height'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/yowsup2-2.5.2-py3.6.egg/yowsup/layers/protocol_media/mediauploader.py", line 169, in run
    self.successCallback(sourcePath, self.jid, result)
  File "/home/saademotion/Projects/whatsapp-framework/app/mac/mac.py", line 286, in <lambda>
    caption)
  File "/home/saademotion/Projects/whatsapp-framework/app/mac/mac.py", line 315, in do_send_media
    entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to, caption=caption)
  File "/usr/local/lib/python3.6/dist-packages/yowsup2-2.5.2-py3.6.egg/yowsup/layers/protocol_media/protocolentities/message_media_downloadable_video.py", line 168, in fromFilePath
    width, height, bitrate, duration = VideoTools.getVideoProperties(path)
  File "/usr/local/lib/python3.6/dist-packages/yowsup2-2.5.2-py3.6.egg/yowsup/common/tools.py", line 323, in getVideoProperties
    return VideoTools.video_meta_data(videoFile)
  File "/usr/local/lib/python3.6/dist-packages/yowsup2-2.5.2-py3.6.egg/yowsup/common/tools.py", line 356, in video_meta_data
    height = ffprobeOutput['streams'][0]['height']
KeyError: 'height'
danielcardeenas commented 6 years ago

Do you have ffmpeg installed in your server/pc?

saade commented 6 years ago

Yes i do!

saade commented 6 years ago
sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
sudo apt-get update
sudo apt-get install ffmpeg

Its strange, some videos are accepted, others doesn't, both .mp4

danielcardeenas commented 6 years ago

Any chance on sending me the video file so I can test?

sehgal10 commented 6 years ago

I'm getting following while sending video. I tried adding package using pip, still getting the error.

Error occured at transfer No module named 'moviepy'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/protocol_media/mediauploader.py", line 165, in run
    self.successCallback(sourcePath, self.jid, result)
  File "/var/www/python/whatsapp-framework-flask/app/mac/mac.py", line 266, in <lambda>
    caption)
  File "/var/www/python/whatsapp-framework-flask/app/mac/mac.py", line 295, in do_send_media
    entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to, caption=caption)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/layers/protocol_media/protocolentities/message_media_downloadable_video.py", line 141, in fromFilePath
    preview = VideoTools.generatePreviewFromVideo(path)
  File "/usr/local/lib/python3.5/dist-packages/yowsup2-2.5.2-py3.5.egg/yowsup/common/tools.py", line 205, in generatePreviewFromVideo
    import moviepy.editor as mvpy
ImportError: No module named 'moviepy'
danielcardeenas commented 6 years ago

Can you try running this in a python shell?

>>> import imageio
>>> imageio.plugins.ffmpeg.download()

If it works, please tell me so I can automate it

sehgal10 commented 6 years ago

Made it work. problem with missing package in virtual environment. Thanks!

danielcardeenas commented 6 years ago

Nice