Ads API POST /videos endpoint Internal Error

video
ads
media-upload

#1

The POST /videos endpoint has been returning 500 errors recently.

Example video link: http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_2mb.mp4

We use the chunked upload process, with media_category set to ‘amplify_video’.

All the APPEND commands are successful with code 204, and here is the response from a FINALIZE command:

status_code: 200, data: {u’media_id_string’: u’702535744728895488’, u’media_id’: 702535744728895488, u’processing_info’: {u’check_after_secs’: 5, u’state’: u’pending’}, u’expires_after_secs’: 15552000, u’size’: 2107842}

We then check the with the STATUS command:
{u’media_id_string’: u’702535744728895488’, u’media_id’: 702535744728895488, u’processing_info’: {u’state’: u’succeeded’, u’progress_percent’: 100}, u’size’: 2107842}

Then POST /videos fails with:

{u’errors’: [{u’message’: u’Internal Error’, u’code’: u’INTERNAL_ERROR’}], u’request’: {u’params’: {}}}

Using twurl instead yields the same:

twurl -X POST -H ads-api.twitter.com “/0/accounts/4no6av/videos?video_media_id=702535744728895488&title=test2&description=2” | jsonpretty
{
“errors”: [
{
“code”: “INTERNAL_ERROR”,
“message”: “Internal Error”
}
],
“request”: {
“params”: {}
}
}


#2

Thanks for this.

I’m actually blocked before this, and therefore unable to reproduce.

Specifically, I am unable to post the video using the amplify_video parameter with the provided video. (Is this in fact the provided video that you used? I believe the bunny video may have encoding that may not be compatible with our platform more broadly.)

My next steps:

  • I’m inquiring with our Product Team on the issues with uploading this specific video.
  • Once you confirm it’s the same video that you uploaded and I can reproduce (with my own upload of the video) I can test your use case and try to reproduce.

A couple additional notes, with all examples using our public sample tool:

  • The small video sample works for upload and attachment to tweet, both as normal and promoted video types.
  • The provided video (big_buck_bunny_720p_2mb.mp4) fails on promoted upload (media_category =amplify_video), with the error {“errors”:[{“code”:44,“message”:“media parameter is invalid.”}]}
  • The provided video (big_buck_bunny_720p_2mb.mp4) fails on normal upload, with the error {u’errors’: [{u’code’: 324, u’message’: u’The validation of media ids failed.’}]}

Thanks for reporting, and I’ll return when I have more.


Promoted video transaction log, from tool:

https://upload.twitter.com/1.1/media/upload.json INIT request: {‘total_bytes’: 2107842, ‘command’: ‘INIT’, ‘media_type’: ‘video/mp4’, ‘media_category’: u’amplify_video’}
https://upload.twitter.com/1.1/media/upload.json INIT response: {u’media_id_string’: u’702778750388277248’, u’media_id’: 702778750388277248, u’expires_after_secs’: 15552000}
https://upload.twitter.com/1.1/media/upload.json APPEND request: segment 0
https://upload.twitter.com/1.1/media/upload.json APPEND response: <Response [204]>
https://upload.twitter.com/1.1/media/upload.json FINALIZE request: 702778750388277248
https://upload.twitter.com/1.1/media/upload.json FINALIZE response: {u’processing_info’: {u’state’: u’pending’, u’check_after_secs’: 5}, u’media_id_string’: u’702778750388277248’, u’media_id’: 702778750388277248, u’expires_after_secs’: 15552000, u’size’: 2107842}
https://upload.twitter.com/1.1/media/upload.json STATUS request: {‘media_id’: u’702778750388277248’, ‘command’: ‘STATUS’}
https://upload.twitter.com/1.1/media/upload.json STATUS response: {u’processing_info’: {u’state’: u’succeeded’, u’progress_percent’: 100}, u’media_id_string’: u’702778750388277248’, u’media_id’: 702778750388277248, u’size’: 2107842}
https://api.twitter.com/1.1/statuses/update.json request: {‘status’: u’asdf PROMOTED’, ‘media_ids’: [u’702778750388277248’]}
https://api.twitter.com/1.1/statuses/update.json response: {“errors”:[{“code”:44,“message”:“media parameter is invalid.”}]}

Normal video transaction log, from tool:

https://upload.twitter.com/1.1/media/upload.json INIT request: {‘total_bytes’: 2107842, ‘command’: ‘INIT’, ‘media_type’: ‘video/mp4’}
https://upload.twitter.com/1.1/media/upload.json INIT response: {u’media_id_string’: u’702779386626322432’, u’media_id’: 702779386626322432, u’expires_after_secs’: 86400}
https://upload.twitter.com/1.1/media/upload.json APPEND request: segment 0
https://upload.twitter.com/1.1/media/upload.json APPEND response: <Response [204]>
https://upload.twitter.com/1.1/media/upload.json FINALIZE request: 702779386626322432
https://upload.twitter.com/1.1/media/upload.json FINALIZE response: {u’errors’: [{u’code’: 324, u’message’: u’The validation of media ids failed.’}]}


#3

Yes, that is one of the actual videos we tested (and one that has previously succeeded on upload + post).

mediainfo 2.mp4
General
Complete name                            : 2.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom
File size                                : 2.01 MiB
Duration                                 : 13s 504ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 249 Kbps
Encoded date                             : UTC 1970-01-01 00:00:00
Tagged date                              : UTC 2014-07-19 17:24:05
Writing application                      : Lavf53.24.2

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L3.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 13s 480ms
Bit rate                                 : 863 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.037
Stream size                              : 1.39 MiB (69%)
Encoded date                             : UTC 1970-01-01 00:00:00
Tagged date                              : UTC 1970-01-01 00:00:00

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 13s 504ms
Bit rate mode                            : Variable
Bit rate                                 : 384 Kbps
Maximum bit rate                         : 417 Kbps
Channel(s)                               : 2 channels
Channel(s)_Original                      : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 630 KiB (31%)
Encoded date                             : UTC 1970-01-01 00:00:00
Tagged date                              : UTC 1970-01-01 00:00:00

#4

Thanks for this. Another quick question from the team:

Are you using additional_owners in you upload and then using the videos endpoint as one of the additional owners?


#5

We set the header X-Additional-Owners to the user id of the account on the upload request.


#6

Thanks for the update. Let me check in and get back to you.


#8

Product team confirmed it as an issue. They are working on it, and will update here when I have more information.

Thanks for your patience.


#9

As a quick update, a patch went out today. Let us know what you’re seeing now.


#10

Tested the same video, and the POST /videos response looks good. Thanks!


#11