15

I have a lot of lecture video content that I would like to have the subtitles for. YouTube automatically generates subtitles for videos under certain conditions (those conditions are still somewhat of a mystery to me).

I would like to be able to use this speech recognition technology outside of YouTube. I don't want to upload every video just to get the transcript (too time consuming), plus, I don't think YouTube will do it for videos that are longer than about 30 minutes (most of them are), further, I don't think it will do it for non-public listed videos (which is a problem because it is premium content that is meant to be sold).

Perfect scenario: There is a program that I can run from my desktop to get the transcript out of these videos and it is of equal or better quality than YouTube's and has the time codes similar to an SRT or the XML that YouTube generates [How to get YouTube subtitles].

Acceptable scenario: There are some tricks I can do to force YouTube to transcribe the videos, whether set to private or public, and despite length.

Doable scenario: There is a library or something that I can use to code my own program. I am good with C# and okay with C++ (But I really prefer C#).

  • 2
    thanks for the link up - from a deaf perspective, very interested to hear how this works... – studiohack Mar 30 '14 at 20:28
  • @studiohack no pun intended. – fredsbend Mar 31 '14 at 19:30
  • LOL, I didn't even realize that! :P – studiohack Apr 1 '14 at 17:55
10

Google implemented the Web Speech API (both for speech recognition and synthesis) into Chrome, which you can use if you are a developer. This is what YouTube uses to generate close captioning on some videos. Maybe you'll find code to interact with it.

The data flow would probably be:

A video file => extract and convert audio => send it to Google API => get the text => write into a SRT.

EDIT: there doesn't seem to be an official API page, other than the W3C spec. So here are more links:

These examples are about using the API from inside Chrome, but you can directly query Google's online speech recognition engine. For instance, Jasper, a speech-recognizing personal assistant for Raspberrry Pi, lets you choose Google as the speech recognition engine.

  • Thank you! I will surely try this out. If it can be done quickly (except for processing time) then I can implement this into my product. What a boon that would be. – fredsbend Jun 24 '15 at 16:29
  • Another source of the API might be a NodeWebkit environment – John Dvorak Feb 2 '18 at 14:39
1

There's a tool called "autosub" (see agermanidis/autosub on github) that does precisely this, although it uses the older Google speech API. The tool uses ffmpeg to strip the audio into FLAC files and then sends the FLAC files to Google for transcription. It produces an SRT or VTT file.

The accuracy is low in part because of the older Google API. There is a more recent API ("Cloud Speech REST API" at https://cloud.google.com/speech/docs/apis ). This API is pretty simple and at some point, I was going to fork autosub to use that.

The alternative is to upload to YouTube and download the VTT file when captioning is completed. The complication with this is that YouTube produces very fine-grained captions (e.g. a couple of words) rather than e.g. a sentence. This makes it harder to check the captions when doing a manual scan.

1

The easiest way is this: go to google docs, open a new text document and select from tools "voice typing", then play your tape. Yes. It's THAT EASY! (and supports multiple languages)

Otherwise you can use a local webpage with HTML5 like this: https://www.labnol.org/software/add-speech-recognition-to-website/19989/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.