Youtube supports some binary caption file formats, such as ebu-stl.
I've got an *.stl file that uploads and processes just fine when I upload it via the web interface. But when I try to upload it via the API v2 with a POST request, it does not seem to recognize the file format properly. The POST request looks like this:
POST /feeds/api/videos/VIDEO_ID/captions HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/vnd.youtube.timedtext; charset=UTF-8
Content-Language: en
Slug: Title of caption track
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY
<Caption File Data>
This is how the *.stl file uploaded via the API looks on the website. There should be several lines with readable text.
Everything works fine when I upload a utf8 plain text subtitle file (eg *.vtt) with the same code. Furthermore, if I upload the stl file once via the web interface and once via the API, and retrieve both files through the API afterwards, they are byte-identical.
It looks like an encoding issue to me- youtube receives the file correctly, but probably parses the entire binary file as UTF-8. However, youtube responds with a 4xx error when I ommit either charset= or Content-Language.
Is it possible to upload binary caption files? I would also appreciate confirmation in case it is not possible.
Minimalistic stl file if you want to try it yourself (hex dump). Read it as (ruby):
stl = hex.chars.each_slice(2).map{|x|x.join.to_i(16)}.pack('C*')