Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Subtitles to Youtube video using Youtube API?

Is it possible to add subtitles to Youtube video using Google Youtube API v3 (important condition - for video's not owner)?

Task: add custom subtitles in selected language using the Google APIs Client Library for JavaScript.

(Google maps API allows add, custom Markers (for example) to their maps, maybe there is a solution for subtitles when we're talking about Youtube API?)

like image 753
Alexander Avatar asked Jul 21 '13 09:07

Alexander


People also ask

How do I add SRT files to YouTube?

The best way is to use the transcription option included below the video player: To do this, press the small dot icon below the video. Choose “open the transcription”. You can then copy and paste a complete transcript, in SRT format, of any video!

Can I add subtitles to someone's YouTube video?

But YouTube does not allow you to add a caption file if you are not the video owner.


1 Answers

Google are calling them "captions" and API section is called YouTube API v2.0 – Captions.

Please note the following requirements for executing caption-related API operations:

  • Captions are only available for API version 2.
  • Captions for a video can only be created, retrieved, modified and deleted by the owner of that video. To perform these operations for a video, you must submit authenticated API requests for which the video's owner is the logged-in user. Accordingly, API requests for caption operations must contain a properly formatted Authorization header.
  • Requests to create (POST), update (PUT) or delete (DELETE) captions must identify your developer key using either the X-GData-Key request header or the key request parameter.

That means, that you can add captions with API, but you need to have owner access to that video. It is strict policy, so that you won't show "wrong" captions on any video, for example, that show different translation of content in video, than there actually is.

You can only hack around this, by putting video inside container, and overlay your own text over video thus simulating captions.

like image 57
Deele Avatar answered Oct 02 '22 15:10

Deele