Uploading videos over and under 128MB

Hello,

I’m trying to upload videos but they aren’t processing on the API. When uploading files under 128MB with a normal method, everything goes well, but when uploading files under 128MB and slicing them up in multiple parts, my videos don’t process anymore, so I was wondering, can’t I slice my videos if they’re under 128MB? What’s weird is that I receive the videoId as a response so that should mean everything worked as intended no?

Hi @michael.fabrie ,

You certainly CAN slice any video - no matter the size. In our sample app https://upload.a.video, all videos are sliced to 1MB chunks, and uploaded - 10 MB videos into 10 chunks, 1 GB chunks into 1024 chunks…

In the first chunk upload, you get a videoId in the response. You must include that videoID in subsequent chunk uploads so that the server knows which video the segments belong to.

I was looking in your account, and I saw 2 videos:

  1. videoName with byterange 0-x,
  2. videoName with byterange x-y.

This makes me think that the second upload did not include the videoId, so the backend just created a new video with the 2nd segment.

if you are using file.slice to break up the videos - there’s often an “off by one” error,

file.slice(0, 1000000);

results in a segment that 1,000,000 bytes, from 0-999,999. (the end value of file.slice is the “first byte NOT in the slice”)

so your content header must read:

contentRange = "bytes "+ 0+"-"+ 999999+"/"+file.size;

Hi @doug,

Thank you for the reply, I found out the error had nothing to do with slice or the API. Being used to C++, I was using Chunkend-- instead of something like Chunkend - 1 at some point but apparently that doesn’t work the same way as it does in javascript, so what ended up happening was that the blobend was 1 byte too big

1 Like

Yes. That is what throws it off often. You can upload a small file in chunks - it’s just not necessary. (It’s great for testing though.) Here is a tutorial and code sample I wrote for doing a chunked upload using Python. It includes mention of the issue you’re describing.

Upload a Big Video File Using Python

YouTube video that talking about history of oliqa dingil