APPEND call in Video upload API giving error

api
video

#1

Hi,

We have implemented twitter video upload API integration in which the video file is uploaded using INIT, APPEND and FINALIZE call.

INIT call:-
Request: {“command”=>“INIT”, “media_type”=>“video/mp4”, “total_bytes”=>9679570}
Response body: {:method=>:post, :body=>{:media_id=>627049039373058048, :media_id_string=>“627049039373058048”, :expires_after_secs=>3599}

In APPEND call, we pass the whole video in a single chunk.
Request: {“command”=>“APPEND”, “media_id”=>627049039373058048, “segment_index”=>0, “file” => actual file binary content as multipart form request}
Response: segment size must be <= 1.

The above problem is coming with some videos only e.g. http://service.twistage.com/videos/cd47110bfe05a/file.source.
A lot of other videos are working fine too.

Can somebody advise as to why this error is coming up?

Thanks
Ganesh


Video uploads via REST API
APPEND call in Video upload API giving error when 2nd chunk uploaded
#2

You need to split up the file in 5mb pieces

Are you developing an Android app?


#3

Your chunks must have about 5mb. Plus, I saw your video and it has a significant resolution, please, check: https://dev.twitter.com/rest/public/uploading-media we were having problems with these kind of things.


#4

@mandicabrito We verify that the video resolution is below 1280*1024 and then only let it through.
But, why is it mandatory to split the file into 5MB chunks? I don’t see it mentioned it the documentation anywhere. Can you point out the documentation link where it is mentioned?


#5

You’re right that we don’t currently call that out explicitly in the docs, however we do mention a max image size of 5Mb, which may infer that the max individual chunk/blob size for video is 5Mb. I’ll see what we can do to clarify this! :smile:


#6

I confirm the doc is not updated :smile: