Twitter's musical-chairs video specifications

Can anyone tell me what the actual limits for twit video are?

This says:

  • Duration should be between 0.5 seconds and 140 seconds (async only)
  • Dimensions should be between 32x32 and 1280x1024
  • Aspect ratio should be between 1:3 and 3:1
This says:

  • Maximum video length is 2 minutes and 20 seconds
  • Maximum file size is 512MB
  • Maximum resolution: 1920 x 1200 (and 1200 x 1900)
  • Aspect ratios: 1:2.39 - 2.39:1 range (inclusive)

This says:

  • Video size <= 15 MB

Three pages, and not a single number in agreement among them! Slow clap, guys. Slow clap.

Since a typical one minute 720p video is going to be around 30 MB, a two minute 15 MB limit forces you to do a pretty stupid juggling act, so I hope those aren't the real numbers.

Empirically, I'm getting this:

  • 13 sec, 3 MB video: works.
  • 60 sec, 28 MB video: upload fails with "Large file can not be finalized synchronously."
  • 60 sec, 6 MB video: upload succeeds, but then posting fails with "Duration too long, maximum:30000, actual:60301"

So maybe they haven't actually rolled out the higher-than-30-second limit yet? Whatever that limit actually is?

Tags: , ,

12 Responses:

  1. Bob Frobber says:

    To be fair, 2 minutes 20 is in fact 140 seconds, so the first two pages managed to have one number in agreement.

    The rest of the train wreck remains, of course, inexcusable. But you can't expect a small company with as few resources as Twitter to be able to keep their documentation consistent.

  2. @andypiper says:

    Hi folks - Andy from the @TwitterDev team here. You make a good point that our information on this is currently fragmented between pages and we're working on consolidating this and making it consistent, too. I can only apologise for the current situation, which partly stems from the different audiences.

    - bear in mind that the Support page is aimed at users who are uploading videos from the Twitter apps or website;

    - that doesn't excuse having the technical API information spread between pages
    - we have in fact rolled out the 140 video support for the API, but you need to use the asynchronous upload route, and in fact we would always recommend you use that chunked async method regardless.

    Finally - we are working hard to improve both the API and the documentation here, as evidenced by the fact that we now have a dedicated Media APIs section on our developer forums - we are listening, appreciate the feedback, and I apologise for the frustration.

    • @andypiper says:

      One more clarification - promoted video / Amplify video is a different entity to any of these, and is part of the Ads products, so videos beyond 140 seconds may exist in Tweet objects like one of those pointed out by @Jay above, but will have been posted as part of the Advertiser video platform.

    • jwz says:

      Well, as far as I can tell, uploading a 720p, 60 second 28MB video using the async chunked API simply does not work. Videos under 30 seconds work; long ones do not. If you see anything that I'm doing wrong here, I'd love to know, because this looks exactly per-spec to me, and I do not get the error until FINALIZE.

      INIT works:

      POST https://upload.twitter.com/1.1/media/upload.json
      Content-Type: application/x-www-form-urlencoded
      ...

      media_type=video%2Fmp4&command=INIT&total_bytes=28923886
      HTTP/1.1 202 Accepted
      Content-Type: application/json;charset=utf-8

      {"media_id":748720179559804928,"media_id_string":"748720179559804928","expires_after_secs":86399}

      APPEND segment_index 0, 5 MB chunk, works:

      POST https://upload.twitter.com/1.1/media/upload.json
      Content-Type: multipart/form-data; boundary=xYzZY
      ...

      --xYzZY
      Content-Disposition: form-data; name="command"

      APPEND
      --xYzZY
      Content-Disposition: form-data; name="segment_index"

      0
      --xYzZY
      Content-Disposition: form-data; name="media_id"

      748720179559804928
      --xYzZY
      Content-Disposition: form-data; name="media"
      Content-Type: video/mp4

      \0\0\0 ftypisom\0\0...
      HTTP/1.1 204 No Content

      APPEND segment_index 1 through 5 also work, just like the above, get the same 204 response. Segments 0 through 4 are 5 MB, segment 5 is the remaining 2 or 3 MB.

      And then FINALIZE always rejects it, unless the file was less than 30 seconds:

      POST https://upload.twitter.com/1.1/media/upload.json
      Content-Type: application/x-www-form-urlencoded
      ...

      media_id=748720179559804928&command=FINALIZE
      HTTP/1.1 400 Bad Request
      Content-Type: application/json;charset=utf-8

      {"request":"\\/1.1\\/media\\/upload.json","error":"Large file can not be finalized synchronously."}

    • jwz says:

      And to be clear, the 400 result from FINALIZE means I've gotten shut down even before doing the async check_after_secs / STATUS dance.

      And if I upload a less-than-30-second video using this same code, and the same INIT / multi-APPEND / FINALIZE dance, it does work. Though in every one of those cases that I've seen work, it did not return check_after_secs, so it took the server-side "post immediately" code path instead of the "finalize and poll" path. But that still pretty strongly suggests that I got the client side right.

      • @andypiper says:

        I'm going to pass this along to the media platform folks to look into. Thanks for the detailed feedback. We've now published an updated version of the docs that brings the info together more consistently, but what you're reporting is clearly not what is intended, so I'll check into it (albeit I'm about to be out for a couple of weeks, so I'll have to prod some other folks to look at it for me)

  3. Stuart Wilkes says:

    Hi there,

    I've also run in to this problem today - if the video is over 15 MB I always get the response ""error":"Large file can not be finalized synchronously."

    Always with a 400 error response, no 'check_after_secs' set - so it looks like its still broken...

    • jwz says:

      Even that doesn't work for me -- like I said, a 60 second but less-than-15MB video gets a "Duration too long" error in FINALIZE. The rule in effect seem to be that the video must be both under 15 MB and under 30 seconds. Which is to say: nothing has changed since last year.

  4. Stefania says:

    I was experiencing this same issue for the past couple of days. I was able to get it to work by adding media_category=tweet_video param to the INIT request. After I did that, FINALIZE was finally returning a successful response that included "processing_info", and I was then able to check the status until the video was ready to tweet.

    So far I have only tested it with a video that was over 15MB but under 30 seconds, so I don't yet know how it will work for videos over 30 seconds. Just thought I'd share my findings here in case it helps you out.

    • jwz says:

      Hey, that did it! Thanks!

      Would have been nice if their documentation said what the possible values for "media_category" are instead of just "required for some cases", sigh....