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

Is uploading a video supported? #761

Closed
jcsk opened this issue Mar 9, 2016 · 6 comments
Closed

Is uploading a video supported? #761

jcsk opened this issue Mar 9, 2016 · 6 comments

Comments

@jcsk
Copy link

jcsk commented Mar 9, 2016

I've tried several ways of uploading a small mp4 video. But I get the following error from twitter:

Twitter::Error::BadRequest: The validation of media ids failed.

I'm not sure if the gem supports chunked video uploading: https://dev.twitter.com/rest/public/uploading-media

I've tried using twurl, and it works with the same file, so I know it's not a size, length, width/height, aspect ratio problem.

The twurl command (after auth) is along the following:

twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=INIT&media_type=video/mp4&total_bytes=113004

twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=707438900436930561&segment_index=0" --file filename.mp4 --file-field "media"

twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=FINALIZE&media_id=707438900436930561"

twurl "/1.1/statuses/update.json" -d "media_ids=707438900436930561&status=You get the point..."

Let me know if I'm missing something. Thanks!

@jonmast
Copy link

jonmast commented Jun 23, 2016

Video upload support was added in #755. You need to be running master to get this though, it hasn't been back-ported to the stable branch.

@narlei
Copy link

narlei commented Sep 14, 2016

@jonmast Why only supports MP4 video file? There any way to send other formats?

@jonmast
Copy link

jonmast commented Sep 14, 2016

@narlei Twitter requires the video to be AAC encoded: https://dev.twitter.com/rest/media/uploading-media#videorecs

@faustoct1
Copy link

faustoct1 commented Oct 12, 2016

fail trying to upload video with: Error creating status. (Twitter::Error::Forbidden)
file = open('http://domain.com/file.mp4')
client.update_with_media('upload video',file)

also fail: media type unrecognized
file = open('http://domain.com/file.mp4')
client.upload(file)

also fail: Could not authenticate you. (Twitter::Error::Unauthorized)
file = open('http://domain.com/file.mp4')
client.upload(file,{video:{'media_type':'video/mp4'}})

client.update('bing!') ok

@mebre688
Copy link

mebre688 commented Nov 23, 2016

the same happen to me when i first try to uploading video my twitter account. however you’ll be getting error if the selected video is not in a supported format. Maximum file size is 512MB. and Maximum video length is 2 minutes and 20 seconds.) See here for more details about formats.) https://support.twitter.com/articles/20172128 and https://dev.twitter.com/rest/public/uploading-media
that may help !!

@danielbonnell
Copy link

Does anyone have a working example of how to upload a video using the chunked method using this gem? I've seen other examples using Bash, PHP, other libraries, etc, but nothing using this gem.

@sferik sferik closed this as completed Sep 19, 2023
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

7 participants