Coder Social home page Coder Social logo

zentechthaingo / podcast-transcriber Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agouil/podcast-transcriber

0.0 2.0 0.0 35 KB

A simple audio file transcriber that uses the Google Cloud Speech API for transcription.

License: MIT License

Python 100.00%

podcast-transcriber's Introduction

podcast-transcriber

A simple audio file transcriber that uses the Google Cloud Speech API for transcription.

Installation

Install this package with pip:

pip install git+https://github.com/agouil/podcast-transcriber.git

Dependencies

Install SoX - Sound eXchange. If you're using Mac you can install through Homebrew:

brew install sox

If you're using Windows or Linux, download the binaries and installer from here.

Requirements

You will need to have a Google API Key in order transcript audio. If you don't have one, then you need to sign up for the Google Cloud Speech API.

How to use it

Set the Google API Key as an enviroment variable. You can simply run,

For UNIX:

export GOOGLE_API_KEY=<your-api-key>

For WINDOWS:

SET GOOGLE_API_KEY=<your-api-key>

Copy the example script below to a file named example.py.

import argparse
import podcast_transcriber

# parse the CLI arguments
parser = argparse.ArgumentParser(prog="python podcast_transcriber.py")
parser.add_argument("input_file", help="input audio file")
args = parser.parse_args()

podcast_transcriber.transcribe(args.input_file)

Run the script with:

python example.py input_file

The argument input_file is the input audio file URL. E.g. For a podcast, you can provide the MP3 file found in a podcast's RSS Feed.

Then the script downloads the file and converts it to smaller files of 40 seconds length each of raw audio bytes through SoX. This is the format the Google Speech API requires - 16-bit 16KHz Linear PCM.

For each file, the script gets the transcript from the Google Speech API. In the end, it concatenates the transcript chunks to a final output file inside the output directory.

Example Audio File

For testing the script you can use this small audio file - https://archive.org/download/testmp3testfile/mpthreetest.mp3

Contributing

Fork the repository, make necessary changes, run tests and submit a pull request.

Testing

Before running tests, install the necessary requirements with:

pip install -r requirements_tests.txt

Run tests with nosetests command.

Issues

To submit any issues, raise an issue through the Issues Page

License

MIT

podcast-transcriber's People

Contributors

agouil avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.