Media not found on media upload from twurl


#1

Hi,

I’ve implemented a Java equivalent version of the following twurl statements. Regardless of whether I use Twurl or curl or java code, I always seem to be getting the same result with my sample videos.

They upload successfully to twitter (seemingly), then then I can’t link them to my account.

The two test videos I’ve tried are:

  • an MP4, 640x360 resolution, Codecs: H.264, AAC, 30 seconds in duration
  • an MP4, 1280x720 resolution, Codecs H.264, AAC, Color profile HD (1-1-1), 15 second in duration

I have read the following documentation:

and looked at the heroku app for video testing:

Do you have more information on what might be going on here? Thanks!

$ twurl -H upload.twitter.com "/1.1/media/upload.json" \
     -d "command=INIT&media_type=video/mp4&total_bytes=1161074"

{"media_id":<the_id>,"media_id_string":"<the_id>",
 "expires_after_secs":86399}

$ twurl -H upload.twitter.com "/1.1/media/upload.json" \
> -d "command=APPEND&media_id=<the_id>&segment_index=0" \
> --file theFilename.mp4 --file-field "media"

$ twurl -H upload.twitter.com "/1.1/media/upload.json" \
   -d "command=FINALIZE&media_id=726659625265688577" \
{"media_id":<the_id>,"media_id_string":"<the_id>",
 "size":1161074,"expires_after_secs":86400,"video":{"video_type":"video\/mp4"}}

$ curl --request 'POST' 'https://ads-api.twitter.com/0/accounts/our_account_id/videos' \
   --data 'video_media_id=<the_id>' \
   --and-assorted-oauth-stuff-here-generated-by-twitter

{"errors":[{"code":"NOT_FOUND","message":"Media not found"}],
"request":{"params":    
{"video_media_id":<the_id>,"account_id":"our_account_id"}}}

#3

I figured out what the problem is. I wasn’t passing “media_category=amplify_video” to the INIT call. Without that parameter setting, the video upload process fails.

With that addition, the process succeeds, both via twurl & via the java code i wrote to do something equivalent.