Skip to content

suraj-ranganath/video-subtitle-generator-and-embedder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This program can generate (by uploading as a private video to youtube and waiting for youtube's auto generated captions to do their magic) and hard code subtitles into videos.

Note: We do this work around instead of simply using google speech api as the subtitles auto generated by Youtube are more accurate than that of google speech api as audio is auto filtertered and normalized. Also video is uploaded privately because of lack of verification for the OAuth Consent Screen. So manually downloading is the only way to get the subtitles. The program establishes a clear sequence for the user to follow.

Setup

  • Required: Python 3.x
  • Download dependencies from requirements.txt
pip install -r requirements.txt
  • Set up FFmpeg. If Windows, download this zip and follow this article to set it up.

  • Set up Youtube Data API Credentials. You'll see that there is no email/password options. Instead, the Youtube API uses OAuth 2.0 to authenticate the upload. The first time you try to upload a video, you will be asked to follow a URL in your browser to get an authentication token. If you have multiple channels for the logged in user, you will also be asked to pick which one you want to upload the videos to. You can use multiple credentials, just use the option --credentials-file. Also, check the token expiration policies.

    The package used to include a default client_secrets.json file. It does not work anymore, Google has revoked it. So you now must create and use your own OAuth 2.0 file, it's a free service. Steps:

    • Go to the Google console.
    • Create project.
    • Side menu: APIs & auth -> APIs
    • Top menu: Enabled API(s): Enable all Youtube APIs.
    • Side menu: APIs & auth -> Credentials.
    • Create a Client ID: Add credentials -> OAuth 2.0 Client ID -> Other -> Name: youtube-upload -> Create -> OK
    • Download JSON: Under the section "OAuth 2.0 client IDs". Save the file to your local system.
    • Use this JSON as your credentials file: --client-secrets=CLIENT_SECRETS or copy it to ~/client_secrets.json.

    Note: client_secrets.json is a file you can download from the developer console, the credentials file is something auto generated after the first time the script is run and the google account sign in is followed, the file is stored at ~/.youtube-upload-credentials.json.

About

This program can generate and hard code subtitles into videos.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages