Error Code 324: Duration too short

media-upload

#1

When my app attempted to upload and broadcast a gif in a Tweet, I received the following error:

{“errors”:[{“code”:324,“message”:“Duration too short, minimum:500, actual:360 (MediaId: snf:887674657255677952)”}]}

The gif in question can be found here: https://twitter.com/LPDOfcMeade/status/887674647692451843.

Any ideas on how to fix this so I can successfully broadcast short gifs like this?


#2

Do you have a link to the original GIF that I might be able to test / reproduce this with?


#3

Here is the entire tweet object - I believe the link for the original gif is in there. Let me know if you need anything else.

Thanks!

{"created_at":"Wed Jul 19 14:05:02 +0000 2017","id":887674647692451843,"id_str":"887674647692451843","text":"I just learned #tv actually turned off around midnight #backintheday \ud83d\udcfa \ud83d\ude27 #mindblown @SilverhawkSRO #LPD https:\/\/t.co\/BKx6vJBynU","display_text_range":[0,103],"source":"<a href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\">Twitter for iPhone<\/a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":881965914752733184,"id_str":"881965914752733184","name":"Officer Meade","screen_name":"LPDOfcMeade","location":"Lincoln, NE","url":"http:\/\/www.lincoln.ne.gov\/city\/police\/","description":"Second Shift Officer for Lincoln Police Department","protected":false,"verified":false,"followers_count":1297,"friends_count":24,"listed_count":7,"favourites_count":1152,"statuses_count":521,"created_at":"Mon Jul 03 20:00:35 +0000 2017","utc_offset":null,"time_zone":null,"geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_link_color":"981CEB","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"000000","profile_text_color":"000000","profile_use_background_image":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/881987247075082240\/nBrIbiMT_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/881987247075082240\/nBrIbiMT_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/881965914752733184\/1499112658","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"tv","indices":[15,18]},{"text":"backintheday","indices":[55,68]},{"text":"mindblown","indices":[73,83]},{"text":"LPD","indices":[99,103]}],"urls":[],"user_mentions":[{"screen_name":"SilverhawkSRO","name":"Lincoln SW SRO","id":3120851425,"id_str":"3120851425","indices":[84,98]}],"symbols":[],"media":[{"id":887674639723274240,"id_str":"887674639723274240","indices":[104,127],"media_url":"http:\/\/pbs.twimg.com\/tweet_video_thumb\/DFGnYbjUIAAf3IN.jpg","media_url_https":"https:\/\/pbs.twimg.com\/tweet_video_thumb\/DFGnYbjUIAAf3IN.jpg","url":"https:\/\/t.co\/BKx6vJBynU","display_url":"pic.twitter.com\/BKx6vJBynU","expanded_url":"https:\/\/twitter.com\/LPDOfcMeade\/status\/887674647692451843\/photo\/1","type":"photo","sizes":{"medium":{"w":500,"h":350,"resize":"fit"},"large":{"w":500,"h":350,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"small":{"w":340,"h":238,"resize":"fit"}}}]},"extended_entities":{"media":[{"id":887674639723274240,"id_str":"887674639723274240","indices":[104,127],"media_url":"http:\/\/pbs.twimg.com\/tweet_video_thumb\/DFGnYbjUIAAf3IN.jpg","media_url_https":"https:\/\/pbs.twimg.com\/tweet_video_thumb\/DFGnYbjUIAAf3IN.jpg","url":"https:\/\/t.co\/BKx6vJBynU","display_url":"pic.twitter.com\/BKx6vJBynU","expanded_url":"https:\/\/twitter.com\/LPDOfcMeade\/status\/887674647692451843\/photo\/1","type":"animated_gif","sizes":{"medium":{"w":500,"h":350,"resize":"fit"},"large":{"w":500,"h":350,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"small":{"w":340,"h":238,"resize":"fit"}},"video_info":{"aspect_ratio":[10,7],"variants":[{"bitrate":0,"content_type":"video\/mp4","url":"https:\/\/video.twimg.com\/tweet_video\/DFGnYbjUIAAf3IN.mp4"}]}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"low","lang":"en","timestamp_ms":"1500473102864"}


#4

No, because the GIF is encoded as an MP4 on upload, so there’s no reference to the original image file in the Tweet object.

Just to clarify - are you trying to repost the media content from that Tweet, or do you have a source GIF file which you uploaded via media/upload which then failed on the subsequent Tweet step (or during the upload)? If you can break this down for me then I might understand more of what is going on :slight_smile:


#5

Sorry for the delay in getting back to you.

A user posted a .gif. I tried to use that media (which twitter turned into a .mp4) to repost in another tweet. Twitter blocked it and looks like it is because the new .mp4 is too short (only 360ms long). So the original .gif worked, but the media file twitter created isn’t acceptable to the API.

Metadata:
major_brand : mp42
compatible_brands: mp42mp41isom
Duration: 00:00:00.36, start: 0.000000, bitrate: 2471 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 500x350, 2453 kb/s, 19.44 fps, 16.67 tbr, 1k tbn, 2k tbc (default)

https://dev.twitter.com/rest/media/uploading-media states:

Duration should be between 0.5 seconds (or 500ms) and 30 seconds (30000 ms)

So there is no way to post a gif via the API that is shorter than 500ms?


#6

Hi Andy - just want to confirm that we aren’t able to upload a .mp4 (converted gif) that is less than 500ms via the API?


#7

500ms is the minimum duration for video, correct.