Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send Video Error yowsup #1689

Open
GabrielHenriqueGz opened this issue Jul 10, 2016 · 7 comments
Open

Send Video Error yowsup #1689

GabrielHenriqueGz opened this issue Jul 10, 2016 · 7 comments

Comments

@GabrielHenriqueGz
Copy link

ERROR:yowsup.common.optionalmodules:ffvideo import failed
ERROR:yowsup.layers.protocol_media.mediauploader:Error occured at transfer type object 'DownloadableMediaMessageProtocolEntity' has no attribute 'fromFilePath'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.0-py2.7.egg/yowsup/layers/protocol_media/mediauploader.py", line 138, in run
self.successCallback(sourcePath, self.jid, result["url"])
File "/home/pi/Desktop/Projeto3/yowCli/layer.py", line 265, in
successFn = lambda filePath, jid, url: self.doSendMedia(mediaType, filePath, url, jid, resultRequestUploadIqProtocolEntity.getIp(), caption)
File "/home/pi/Desktop/Projeto3/yowCli/layer.py", line 251, in doSendMedia
entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, ip, to, caption = caption)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.0-py2.7.egg/yowsup/layers/protocol_media/protocolentities/message_media_downloadable_video.py", line 134, in fromFilePath
entity = DownloadableMediaMessageProtocolEntity.fromFilePath(path, url, DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO, ip, to, mimeType, preview)
AttributeError: type object 'DownloadableMediaMessageProtocolEntity' has no attribute 'fromFilePath'
ERROR:layer:Upload file /home/pi/Desktop/Projeto3/videos/video.avi to https://mmi478.whatsapp.net/u/o8DiDg86ruOU9kNCf3v6nf5es8sABTdMTAqVWA/AokDljlXhMDs2gjTHXPgQb3JqeBDAg66l_sHB26LmBBh for XXMYNUMBER@s.whatsapp.net failed!

Please Help!

@GabrielHenriqueGz
Copy link
Author

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-y9gXBT/ffvideo/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-SMHZg9-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-y9gXBT/ffvideo
Storing debug log for failure in /root/.pip/pip.log

@jlguardi
Copy link
Collaborator

Remove from setup.py ffvideo dependency and try again.

@GabrielHenriqueGz
Copy link
Author

How to make this ?
This: "error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1" it happens when i try to install ffvideo package.
Sorry. I'm python beginner.

@dargmuesli
Copy link

dargmuesli commented Sep 7, 2016

This is the same issues as #1662 and #1656.
I got the same error message too. On my Raspberry Pi 2b (Jessie) I cannot sudo pip install ffvideo successfully. It outputs some lines saying

ffvideo/ffvideo.c:[...]:[...]: error: 'struct AVStream' has no member named 'r_frame_rate'

Somehow it has to do with both, yowsup and ffvideo itself. Did you find a solution? Or do you think if I get ffvideo installed it will work? Because nevertheless DownloadableMediaMessageProtocolEntity has no .fromFilePath ...

@dargmuesli
Copy link

dargmuesli commented Sep 7, 2016

Ok, one hour later: I got it now. It is indeed 2 seperate issues.

First

fromFilePath was not updated with 0f18179 by @tgalal in message_media_downloadable_audio.py and message_media_downloadable_video.py accordingly. @tanquetav did so in pull request #1564.
I'll try to get an own fork of it running as the pr is open since 2 May 2k16 ...

Second

FFVideo's newest version is currently 0.0.13 which is from 2013-02-24 so it's extremely out of date. What worked for me was editing FFVideo.c and replacing all r_frame_rate with avg_frame_rate. Then it was no problem for me installing it via sudo python setup.py install! Though yowsup still tells me that there was an error importing FFVideo... I'll investigate.

For both problems I will add a reference to an easy fix tomorrow.

@dargmuesli
Copy link

dargmuesli commented Sep 8, 2016

Here are the fixes:

First

GitHub repository Dargmuesli/yowsup.
Contains the original yowsup source + builder support for audio and video upload!

Second

BitBucket repository Dargmuesli/FFVideo.
Contains the original FFVideo source + r_frame_rate-fix!

You can download and install them as usual with sudo python setup.py install.

@dargmuesli
Copy link

dargmuesli commented Sep 14, 2016

If - for some reason - importlib's import_module does not work and you still get the same import error, change yowsup/common/tools.py to the following:

from ffvideo import VideoStream
class VideoTools:
    @staticmethod
    def getVideoProperties(videoFile):
        # with FFVideoOptionalModule() as imp:
        # VideoStream = imp("VideoStream")
        s = VideoStream(videoFile)
        return s.width, s.height, s.bitrate, s.duration #, s.codec_name

    @staticmethod
    def generatePreviewFromVideo(videoFile):
        #with FFVideoOptionalModule() as imp:
        #VideoStream = imp("VideoStream")
        fd, path = tempfile.mkstemp('.jpg')
        stream = VideoStream(videoFile)
        stream.get_frame_at_sec(0).image().save(path)
        preview = ImageTools.generatePreviewFromImage(path)
        os.remove(path)
        return preview

But note that captions for videos are currently not send.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants