"Bad Media, unable to process: None." when sending an uploaded video longer than 4 seconds through DM



I’m currently exploring the new DM Media APIs. I’ve successfully uploaded a video through the chunked upload API, given it a media_category of dm_video, and a media_type of video/mp4.

Upon attaching it to a DM, for most videos I’m getting an error of There was an error sending your message: Bad Media, unable to process: None., with error code 151.

Looking into this more, I’ve discovered that the file sizes don’t seem to matter - they’re all well-within the range of what’s allowed. But any video over 4 seconds long is being rejected, and any video under 4 seconds is being accepted, and the DM sent.

It doesn’t state 4 seconds as the limit in the documentation, and I wouldn’t think this would be the limit. Unless we’re inventing the new Vine here. :stuck_out_tongue:

Just to share my findings, here’s the results from the videos I attempted to upload:

Video 1 - not allowed
duration: 21.3
dimensions: 224.0 x 128.0
frame rate: 15.0
video size: 421,026 bytes

Video 2 - not allowed
duration: 4.5
dimensions: 568.0 x 320.0
frame rate: 29.9778
video size: 412,998 bytes

Video 3 - allowed
duration: 3.1
dimensions: 568.0 x 320.0
frame rate: 29.9833
video size: 313,277 bytes

Video 4 - allowed
duration: 3.23
dimensions: 568 x 320
frame rate: 30.0
video size: 322,021 bytes

Unable to attach media to direct messages
"Request for unsupported media category TweetImage with mediaId" when sending DM

The issue was I wasn’t handling the STATUS part of the multi-part upload process, thus the media wasn’t ready. I’ll leave this here should anyone else face the same error.


Thanks for clarifying the solution!