PHPackages                             dragonzap/subtitle-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dragonzap/subtitle-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dragonzap/subtitle-generator
============================

Allows you to generate subtitles for any video file provided. WEBVTT format is supported

v1.0.2(2y ago)047GPL-2.0-or-laterPHP

Since Jan 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dragonzapeducation/SubtitleGenerator)[ Packagist](https://packagist.org/packages/dragonzap/subtitle-generator)[ RSS](/packages/dragonzap-subtitle-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

SubtitleGenerator
=================

[](#subtitlegenerator)

PHP library that generates WebVTT subtitles from input video files, requires google cloud bucket and google speech to text API's which can be found at [Google Cloud Console](https://console.cloud.google.com).

Using without Laravel framework
-------------------------------

[](#using-without-laravel-framework)

The library can be used with or without Laravel framework. Seek the [test.php](https://github.com/dragonzapeducation/SubtitleGenerator/blob/main/test.php) file for use case without Laravel framework.

Run the composer command to install the subtitle package

```
composer require dragonzap/subtitle-generator

```

Using with Laravel framework
----------------------------

[](#using-with-laravel-framework)

To use this with laravel framework start by installing the subtitle package Run the composer command to install the subtitle package:

```
composer require dragonzap/subtitle-generator

```

Next open the config/app.php file and update the 'providers' array

```
 'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        // Add the below provider
        Dragonzap\SubtitleGenerator\SubtitleGeneratorProvider::class
        //...
 ];

```

Next open up your .env file and add the following environment variables

- `GOOGLE_CLOUD_SPEECH_TO_TEXT_PROJECT_ID`:

    - **Description**: This is the project ID for the Google Cloud Speech-to-Text service. It uniquely identifies your project on the Google Cloud platform.
- `GOOGLE_CLOUD_SPEECH_TO_TEXT_APPLICATION_CREDENTIALS`:

    - **Description**: Path to the JSON file that contains your service account key. This file provides authentication credentials to your application so it can interact with Google Cloud APIs.
- `GOOGLE_CLOUD_SPEECH_TO_TEXT_STORAGE_BUCKET`:

    - **Description**: The name of the Google Cloud Storage bucket where files related to the Speech-to-Text processing will be stored.
- `GOOGLE_CLOUD_SPEECH_TO_TEXT_AUDIO_FILE_TMP_DIRECTORY`:

    - **Description**: The directory where extracted WAV files will be temporarily stored for processing by Google Cloud Speech-to-Text. These files are automatically deleted after the job is completed. If not set in the environment, it defaults to `'audio-files'`.

Next you need to run the following command in your Laravel directory to publish the configuration

```
php artisan vendor:publish --provider="Dragonzap\SubtitleGenerator\SubtitleGeneratorProvider" --force

```

Now you should have a new file called config/dragonzap\_subtitles.php that looks like this:

```
