Skip to main content

Input a local file or url and this service will transcribe it using Mozilla Deepspeech

Project description

transcribe-anything

Input a local file or url and this service will transcribe it using Mozilla Deepspeech 0.9.3.

Build Status

Actions Status Actions Status Actions Status

Example

  • Example (cmd):
    • transcribe_anything <YOUTUBE_URL> > out_subtitles.txt
    • transcribe_anything <LOCAL.MP4/WAV> > out_subtitles.txt
  • Example (api):
    from transcribe_anything.api import bulk_transcribe
    
    urls = ['https://www.youtube.com/watch?v=Erk4_jFDjzQ']
    def onresolve(url, sub): print(url, sub)
    def onfail(url): print(f'Failed: {url}')
    bulk_transcribe(urls, onresolve=onresolve, onfail=onfail)
    

Quick start

Optional: Create a virtual python package

  • Works for Ubuntu/MacOS/Win32
  • mkdir transcribe_anything
  • cd transcribe_anything
  • Download and install virtual env:
    • curl -X GET https://raw.githubusercontent.com/zackees/make_venv/main/make_venv.py -o make_env.py
    • python make_env.py
  • Enter the environment:
    • source activate.sh

The environment is now active and the next step will only install to the local python. If the terminal is closed then to get back into the environment cd transcribe_anything and execute source activate.sh

Required: Install to current python environment

  • pip install transcribe-anything
    • The command transcribe_anything will magically become available.
  • transcribe_anything <YOUTUBE_URL> > out_subtitles.txt
  • -or- transcribe_anything <MY_LOCAL.MP4/WAV> > out_subtitles.txt

How does it work?

This program performs fetching using yt-dlp for downloading videos from video services, and then stripping the audio track out.

static_ffmpeg is then called to transcode the audio track into a specific format that DeepSpeech requires.

Once the audio file has been prepared, pydeepspeech is called. This little utility automatically downloads the proper AI models and installs them into the proper path so that deepspeech can be called. It also partitions the input wav file into chunks, split at the parts of silence, in order to make processing go easier (DeepSpeech degrades performance significantly with longer audio clips, so they have to be kept short.)

Tech Stack

Testing

  • All tests are run by tox, simply go to the project directory root and run it.

Versions

  • 1.2.6: Supports spaces in file names now.
  • 1.2.5:
    • Improved handling of YouTube downloads by switching youtube-dl -> yt-dlp

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transcribe-anything-1.2.6.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transcribe_anything-1.2.6.0-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file transcribe-anything-1.2.6.0.tar.gz.

File metadata

  • Download URL: transcribe-anything-1.2.6.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0

File hashes

Hashes for transcribe-anything-1.2.6.0.tar.gz
Algorithm Hash digest
SHA256 f643885cc12a50502a787476b7e9cc86f117eb05dd6af8a669ca805597d66c59
MD5 5a7e6c0739564141e1552d50852a39ef
BLAKE2b-256 4111b04663c2406c4ec0fdff2590f5bb42b5ecacea218deb0a01485b1625e159

See more details on using hashes here.

File details

Details for the file transcribe_anything-1.2.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: transcribe_anything-1.2.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0

File hashes

Hashes for transcribe_anything-1.2.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 61f48f81448cb7e709e256475182dc9af36db61627eacff735f18072fb902a44
MD5 ec85941115af09e005f53ac341a4c57f
BLAKE2b-256 1c089e68dec9cce52504e57bb58e997cfb66f5dda38dd24b4cc4da0d0fe40eb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page