06-03-2023 05:35 PM
I'm trying to upload videos to eBay through the media API, but it keeps failing with statusMessage, "Processing failed because of corrupted video."
I've tried multiple mp4 files, both MPEG-4 Part 10 and MPEG-4 AVC.
I noticed that when trying to upload, the binary size reported by Python doesn't match the video size reported by eBay. At first there's some error, for example "Content-Length 544024 cannot be more than video size 543879." I have to then hardcode the video size to force it through. So it's not too surprising the API is reporting that my video is corrupted, maybe there are some issues with the file headers, or something.
The way I'm uploading the video is like so:
with open(path, 'rb') as fin:
files = {'file': fin}
Then using requests.post with these files, and setting the content type to application/octet-stream.
I don't know what else to try at this point. Maybe I need to read the file another way?