Unsupported format AnimatedGif, error 324 while attaching gif file



I get this error when attaching a gif file ig to a tweet using the api? the gif file is definitely small, 1.3mb, 485x284 and 50 frames i think. It is successfully uploaded using the chunked method and i get a media id which fails when i try to attach it to a tweet


Sounds odd, are you able to attach it via the website or the Twitter mobile apps? Are you able to share the GIF somewhere online so that we can take a look?


Additionally, is that the exact error message? If you can share anything about the parameters you’re using when you do the media upload, that would be helpful.


attached the gif i used to get this result
body: '"{\\"errors\\":[{\\"code\\":324,\\"message\\":\\"Unsupported format AnimatedGif\\"}]}"' } — JSON string formatted

Im also using a 3rd party library so right now im not too sure if this is formatted by the library or its direct twitter response.

I dont know if all the chunking code is necessary to see where the problem is but making all the calls , INIT, APPEND, FINALIZE and STATUS (if pending) which runs with no promblem to get me media_id. Problem comes when i try to post and update with_media_id when i get this error message.


I just posted this on my test account using a lightly-modified version of this sample code (I removed the media_type and media_category values from the INIT call). So it seems like something in the third party library could be incorrectly setting a parameter during the chunked upload. Which library are you using, out of interest?


thanks @andypiper “removed the media_type and media_category values from the INIT call” and now it works for png,jpg and gifs.

Now having trouble with mp4s saying “media type unrecognised” using this file http://techslides.com/demos/sample-videos/small.mp4 on FINALIZE call


That works fine if you include the media_type=video/mp4 and media_category=tweetvideo parameters required for a video upload.


that did the trick, thanks @andypiper :slight_smile: , i just have to conditionally set the media_category and media_type for videos


Great, yes that seems to be the key, and that’s one reason why we published the sample code. Happy you’re all set!