GIF file size limites between web and API

animatedgif

#1

Hi,

For a project of mine, I want to be able to, from the API, post relatively high quality looping video.

On web, it is possible to upload gif files of a size up to 15 megabytes. The limit in the REST API is, at this point, smaller (5 megabytes). Will the API limits be made consistent with the limits on web any time soon? Or will there, alternately, at some point in the near future be a way to upload gif files pre-converted to mp4, treated the same as gif files are currently (autoplay, looping, no sound)?

Best,
L. Diener


#2

Thanks for the question. I’m not aware of a plan to increase the size for animated GIFs in the media API, but I’ll definitely pass this along to the team to see what they intend in the future.


#3

I have a clarifying question on image and animated gif size. The developer documentation here: https://dev.twitter.com/rest/media/uploading-media#gifrecs

It first says: “Image size <= 5 MB, animated GIF size <= 5 MB” but then right under that it says “Tweet creation requires images to be <= 3 MB”. Does that mean that the actual file size limitation for images/animated gifs with tweets is <= 3MB?


#4

For my algorithmic art bot, I have found the limit to be 5mb. I convert bigger gifs to 30s mp4 videos with ffmpeg. I do wish the limit for gifs was the same 15mb as on web, as it would make my code simpler and much more stable.


#5

So we did some testing on this. It turns out that the API only supports images <= 3MB (including non-animated gifs) (we get the error from Twitter saying ‘Image file size must be <= 3145728 bytes’ when trying to upload a larger file). However, the API supports animated gifs <=5MB. The documentation here https://dev.twitter.com/rest/media/uploading-media#gifrecs does not make this clear.

Does anyone have recommendations on a library that detects whether a .gif is animated or not?