Media Upload API does not allow video more than 30 seconds

media-upload

#1

Upload Media API does not allow to video more than 30 seconds.
We are using INIT, APPEND & FINIALIZE Command Request. Everything seems working up to this point.

When we use that media id to create status on twitter we are getting following error:-

Duration too long, maximum:30000, actual:45045 (MediaId: snf:748477236530061312)

What this error means??
How can we resolve this issue??


Video Too long on API?
#2

This means the Media API doesn’t allow Videos longer than 30s(30000ms).

According to this Reference for Media API you can only resolve it by following the rules posted in the Documentation, like keeping videos shorter than 30s.
But a workaround might be to upload the video somewhere else accessible like on a different webpage and just post the link to it on Twitter then :slight_smile:

Best Regards
Dimitry Nagorny


#3

Upload Media API says that with Async Post we can upload upto 512MB.

How can we achieve this with PHP my friend??


#4

That I simple don’t know, sorry :neutral_face::confused:.
But others for sure might know and can help you out if they read this.

Best Regards
Dimitry Nagorny


#5

But the comment, “keeping videos shorter than 30s”, contradicts the announcement for 140 second video support in the Media API by @joncipriano. The link you provided to the Reference for Media API clearly states the 140 second support as well.

I actually get the same exact error above as @programmertool using async method with Media API and only if the video file is greater than 30 seconds in duration. Technically, there is no error returned as promised by the API but the urlResponse code is a 400 and the response data has the “Duration too long, maximum:30000” message. The log below includes the message as well as the failed MediaID: 750564825571426304. Any idea what I might be doing wrong?

[3337:2915720] Twitter Stage1 HTTP Response: 202, responseData: {"media_id":750564825571426304,"media_id_string":"750564825571426304","expires_after_secs":86400}
[3337:2915720] chunk index -> 1, data size -> 5000000 bytes
[3337:2915720] chunk index -> 2, data size -> 5000000 bytes
[3337:2915720] chunk index -> 3, data size -> 2636231 bytes
[3337:2915720] stage one success, mediaID -> 750564825571426304
[3337:2915709] Twitter Stage2 - 1 HTTP Response: 204, 
[3337:2915720] Twitter Stage2 - 2 HTTP Response: 204, 
[3337:2915715] Twitter Stage2 - final, HTTP Response: 204, 
[3337:2915718] Twitter Stage3 HTTP Response: 201, {"media_id":750564825571426304,"media_id_string":"750564825571426304","size":12636231,"expires_after_secs":86400,"video":{"video_type":"video\/mp4"}}
[3337:2915867] Twitter Stage4 HTTP Response: 400, {"errors":[{"code":324,"message":"Duration too long, maximum:30000, actual:45205 (MediaId: snf:750564825571426304)"}]}

Thanks!


Placing LONG video (>30 seconds) into tweets
#6

@corwinderkatch @programmertool Are you passing media_category param? It is required for longer videos.


#7

Yup, that was it. See Ne error: Media sharing is only supported on managed mediaId(s)


#8

This topic was automatically closed after 2 days. New replies are no longer allowed.