Convert images or audio files to plain text on the command line
Project description
verb - To convert a representation of language to another representation.
noun - Command line application to extract plain text from images and audio files, written in Python.
OCR
To extract the text from an image:
$ transcribe ocr /path/to/image.jpg
Speech
To extract the text from an audio file:
$ transcribe speech /path/to/audio.mp3
Installation
Google Cloud setup
Transcribe uses Google’s cloud services to perform the text extraction, that means you have to setup a Google cloud project. Below is roughly how I did that…
I went to The console
Selected Project in the top left corner (to the right of Google Cloud Platform) and then create a new project, wait a bit for it to create the project and switch to it (this took like 20 seconds while I was trying to figure out what the heck was going on). Then activate the vision and speech apis (I think storage is automatically activated) and then select Credentials, and create an api key. More auth info here.
Turns out I also needed to create a service json file. To do this I needed to go to the dashboard for the project and then click Create credentials and choose Service account key.
Then add this to your .bash_profile or something similar:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keyfile.json"
ffmpeg
If you’re on a Mac and you use Homebrew, you can install ffmpeg like:
$ brew install --with-opus ffmpeg
If you’re not on a Mac or don’t use Homebrew you’re on your own.
Transcribe
Install using pip:
$ pip install transcribe
or the latest and greatest:
$ pip install "git+https://github.com/Jaymon/transcribe#egg=transcribe"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file transcribe-0.0.7.tar.gz
.
File metadata
- Download URL: transcribe-0.0.7.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93cbea8ccc05220ed89031b05a3db92e3d9402c5f813676a214bd046c134180d |
|
MD5 | 765d4a51f2e2870d8f5e52be0b52f2bb |
|
BLAKE2b-256 | d3c631833a0eec1795187a52126540e01c8a23fd2ed399ea67187352abea7d51 |