I have a directory of video files in my Google Drive that I would like to attach subtitles to, and keep the subtitles updated regularly.
I am aware that this can be achieved through the in-browser Google Drive interface, by manually right-clicking on each video to "Manage caption tracks" and then locating the subtitles file (format: .vtt
) in my Google Drive. However, I noticed that when I update the subtitles file later, the video does not "refresh" its access to it, but instead continues to display an older version of the subtitles .vtt file.
Is there a way to add and/or update the subtitles track using the Google Drive API? For background, I use PyDrive, and when I look at the GoogleDriveFile properties for one of my videos with subtitles, I don't see any parameters that look like the subtitles file or a link to the subtitles file, or any other parameters like the language code (en
for English, etc.).
At the moment there are no API methods to do this. The Drive API documentation doesn't show any. Also, the metadata for Drive files does not include anything related to captions/subtitles. This means that adding these subtitles is probably done on a different "layer" unique to the Drive player that doesn't affect the files at all, and an API has not been considered for it.
There's also this issue tracker post requesting this feature, but it seems that it was shot down as they want Drive to focus more on file sharing. This may or may not change in the future.
As an alternative you could consider importing your videos from Drive to YouTube since the YouTube API does have methods to manage captions.
Google also has an API called Transcoder. I'm not familiar with it but after reviewing the documentation it seems that it allows you to transcode videos and add subtitles to them. This would be more complex and would probably require you to download, transcode, and reupload the videos which would end up with built-in subs, but it is something that you could potentially fully automate with APIs.