3

I am able to upload videos to Facebook via their Graph API, but unable to upload captions (cc) for those videos. According to their documentation on uploading video captions only the video id, locale, and srt filename must be provided. However, when posting the request

r = requests.post("https://graph.facebook.com/v" + str(self.version) + "/" + path + "?" +
    post_data, files={captions_file: open(captions_file, 'rb')})

this is the result:

{"error":{"message":"(#100) Invalid file. Expected file of one of the following types:
    application\/octet-stream","type":"OAuthException","code":100}}

My confusion is the documentation specifies the caption file as filename.locale.srt, but the error specifies a file of MIME type application/octet-stream which a .srt file does not apply.

How can a .srt file be sent via application/octet-stream?

Zen
  • 51
  • 3

2 Answers2

1

I was trying to upload captions for the facebook videos, but the only error I was getting was "(#100) Invalid file. Expected file of one of the following types: application/octet-stream".

So I wrote a ticket in facebook and seems like this is valid bug.

I'm trying to add captions to video, but the only error I'm getting is "Invalid file. Expected file of one of the following types: application/octet-stream"

The file that I'm using is http://www.apps.bg/filename.bg_BG.srt

Steps to reproduce the bug: 1. Trying to upload captions from api ( /v2.4/video_id/captions )

And the answer that I got was

"We have managed to reproduce this issue and it appears to be a valid bug. We are assigning this to the appropriate team."

https://developers.facebook.com/bugs/1470577926590877

So we have to wait to fix it - or if someone finds a workaround. Hope that this will help you.

0

I had the same problem. The solution is to using file locally ad pass it instead of URL address. Something like this:

curl -i -X POST -F "captions_file=@\"subs.bg_BG.srt\"" https://graph.facebook.com/v2.7/***/captions?access_token...
micobg
  • 1,272
  • 6
  • 21
  • 35