transcribe-anything


Nametranscribe-anything JSON
Version 2.7.34 PyPI version JSON
download
home_pagehttps://github.com/zackees/transcribe-anything
SummaryUses whisper AI to transcribe speach from video and audio files. Also accepts urls for youtube, rumble, bitchute, clear file, etc.
upload_time2024-04-24 05:27:02
maintainerNone
docs_urlNone
authorZach Vorhies
requires_python>=3.10.0
licenseMIT
keywords transcription translation speech-to-text speech-recognition command-line-tool ai whisper ml anything
VCS
bugtrack_url
requirements static-ffmpeg yt-dlp appdirs disklru isolated-environment FileLock webvtt-py
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # transcribe-anything
[![MacOS_Tests](https://github.com/zackees/transcribe-anything/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/test_macos.yml)
[![Win_Tests](https://github.com/zackees/transcribe-anything/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/test_win.yml)
[![Ubuntu_Tests](https://github.com/zackees/transcribe-anything/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/test_ubuntu.yml)
[![Lint](https://github.com/zackees/transcribe-anything/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/lint.yml)

![image](https://github.com/zackees/transcribe-anything/assets/6856673/94bdd1fe-3225-438a-ac1b-09c81f1d4108)


### USES WHISPER AI

Over 300+⭐'s because this program this app just works! This whisper front-end app is the only one to generate a `speaker.json` file which partitions the conversation by who doing the speaking.

[![Star History Chart](https://api.star-history.com/svg?repos=zackees/transcribe-anything&type=Date)](https://star-history.com/#zackees/transcribe-anything&Date)

Easiest whisper implementation to install and use. Just install with `pip install transcribe-anything`. GPU acceleration is *automatic*, using the *blazingly* fast [insanely-fast-whisper](https://github.com/Vaibhavs10/insanely-fast-whisper) as the backend for `--device insane`. This is the only tool to optionally produces a `speaker.json` file, representing speaker-assigned text that has been de-chunkified.

Hardware acceleration on Windows/Linux/MacOS Arm (M1, M2, +) via `--device insane`

Input a local file or youtube/rumble url and this tool will transcribe it using Whisper AI into subtitle files and raw text.

Uses whisper AI so this is state of the art translation service - completely free. 🤯🤯🤯

Your data stays private and is not uploaded to any service.

The new version now has state of the art speed in transcriptions, thanks to the new backend `--device insane`, as well as producing a `speaker.json` file.



```bash
pip install transcribe-anything
# slow cpu mode, works everywhere
transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ
# insanely fast using the insanely-fast-whisper backend.
transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device insane
# translate from any language to english
transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device insane --task translate
```



#### Insanely fast on `cuda` platforms

If you pass in `--device insane` on a cuda platform then this tool will use this state of the art version of whisper: https://github.com/Vaibhavs10/insanely-fast-whisper, which is MUCH faster and has a pipeline for speaker identification (diarization) using the `--hf_token` option.

Also note, `insanely-fast-whisper` (`--device insane`) included in this project has been fixed to work with python 3.11. The upstream version is still broken on python 3.11 as of 1/22/2024.

#### Speaker.json

When diarization is enabled via `--hf_token` (hugging face token) then the output json will contain speaker info labeled as `SPEAKER_00`, `SPEAKER_01` etc. For licensing agreement reasons, you must get your own hugging face token if you want to enable this feature. Also there is an additional step to agree to the user policies for the `pyannote.audio` located here: https://huggingface.co/pyannote/segmentation-3.0. If you don't do this then you'll see runtime exceptions from `pyannote` when the `--hf_token` is used.

What's special to this app is that we also generate a `speaker.json` which is a de-chunkified version of the output json speaker section.

### speaker.json example:
```json
[
  {
    "speaker": "SPEAKER_00",
    "timestamp": [
      0.0,
      7.44
    ],
    "text": "for that. But welcome, Zach Vorhees. Great to have you back on. Thank you, Matt. Craving me back onto your show. Man, we got a lot to talk about.",
    "reason": "beginning"
  },
  {
    "speaker": "SPEAKER_01",
    "timestamp": [
      7.44,
      33.52
    ],
    "text": "Oh, we do. 2023 was the year that OpenAI released, you know, chat GPT-4, which I think most people would say has surpassed average human intelligence, at least in test taking, perhaps not in, you know, reasoning and things like that. But it was a major year for AI. I think that most people are behind the curve on this. What's your take of what just happened in the last 12 months and what it means for the future of human cognition versus machine cognition?",
    "reason": "speaker-switch"
  },
  {
    "speaker": "SPEAKER_00",
    "timestamp": [
      33.52,
      44.08
    ],
    "text": "Yeah. Well, you know, at the beginning of 2023, we had a pretty weak AI system, which was a chat GPT 3.5 turbo was the best that we had. And then between the beginning of last",
    "reason": "speaker-switch"
  }
]
```

Note that `speaker.json `is only generated when using `--device insane` and not for `--device cuda` nor `--device cpu`.

#### `cuda` vs `insane`

Insane mode eats up a lot of memory and it's common to get out of memory errors while transcribing. For example a 3060 12GB nividia card produced out of memory errors are common for big content. If you experience this then pass in `--batch-size 8` or smaller. Note that any arguments not recognized by `transcribe-anything` are passed onto the backend transcriber.

Also, please don't use `distil-whisper/distil-large-v2`, it produces extremely bad stuttering and it's not entirely clear why this is. I've had to switch it out of production environments because it's so bad. It's also non-deterministic so I think that somehow a fallback non-zero temperature is being used, which produces these stutterings.

`cuda` is the original AI model supplied by openai. It's more stable but MUCH slower. It also won't produce a `speaker.json` file which looks like this:


`--embed`. This app will optionally embed subtitles directly "burned" into an output video.

# Install

This front end app for whisper boasts the easiest install in the whisper ecosystem thanks to [isolated-environment](https://pypi.org/project/isolated-environment/). You can simply install it with pip, like this:

```bash
pip install transcribe-anything
```

# GPU Acceleration

GPU acceleration will be automatically enabled for windows and linux. Mac users are stuck with `--device cpu` mode. But it's possible that `--device insane` and `--model mps` on Mac M1+ will work, but this has been completely untested.

# Usage

```bash
 transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ
```

Will output:

```
Detecting language using up to the first 30 seconds. Use `--language` to specify the language
Detected language: English
[00:00.000 --> 00:27.000]  We're no strangers to love, you know the rules, and so do I
[00:27.000 --> 00:31.000]  I've built commitments while I'm thinking of
[00:31.000 --> 00:35.000]  You wouldn't get this from any other guy
[00:35.000 --> 00:40.000]  I just wanna tell you how I'm feeling
[00:40.000 --> 00:43.000]  Gotta make you understand
[00:43.000 --> 00:45.000]  Never gonna give you up
[00:45.000 --> 00:47.000]  Never gonna let you down
[00:47.000 --> 00:51.000]  Never gonna run around and desert you
[00:51.000 --> 00:53.000]  Never gonna make you cry
[00:53.000 --> 00:55.000]  Never gonna say goodbye
[00:55.000 --> 00:58.000]  Never gonna tell a lie
[00:58.000 --> 01:00.000]  And hurt you
[01:00.000 --> 01:04.000]  We've known each other for so long
[01:04.000 --> 01:09.000]  Your heart's been aching but you're too shy to say it
[01:09.000 --> 01:13.000]  Inside we both know what's been going on
[01:13.000 --> 01:17.000]  We know the game and we're gonna play it
[01:17.000 --> 01:22.000]  And if you ask me how I'm feeling
[01:22.000 --> 01:25.000]  Don't tell me you're too much to see
[01:25.000 --> 01:27.000]  Never gonna give you up
[01:27.000 --> 01:29.000]  Never gonna let you down
[01:29.000 --> 01:33.000]  Never gonna run around and desert you
[01:33.000 --> 01:35.000]  Never gonna make you cry
[01:35.000 --> 01:38.000]  Never gonna say goodbye
[01:38.000 --> 01:40.000]  Never gonna tell a lie
[01:40.000 --> 01:42.000]  And hurt you
[01:42.000 --> 01:44.000]  Never gonna give you up
[01:44.000 --> 01:46.000]  Never gonna let you down
[01:46.000 --> 01:50.000]  Never gonna run around and desert you
[01:50.000 --> 01:52.000]  Never gonna make you cry
[01:52.000 --> 01:54.000]  Never gonna say goodbye
[01:54.000 --> 01:57.000]  Never gonna tell a lie
[01:57.000 --> 01:59.000]  And hurt you
[02:08.000 --> 02:10.000]  Never gonna give
[02:12.000 --> 02:14.000]  Never gonna give
[02:16.000 --> 02:19.000]  We've known each other for so long
[02:19.000 --> 02:24.000]  Your heart's been aching but you're too shy to say it
[02:24.000 --> 02:28.000]  Inside we both know what's been going on
[02:28.000 --> 02:32.000]  We know the game and we're gonna play it
[02:32.000 --> 02:37.000]  I just wanna tell you how I'm feeling
[02:37.000 --> 02:40.000]  Gotta make you understand
[02:40.000 --> 02:42.000]  Never gonna give you up
[02:42.000 --> 02:44.000]  Never gonna let you down
[02:44.000 --> 02:48.000]  Never gonna run around and desert you
[02:48.000 --> 02:50.000]  Never gonna make you cry
[02:50.000 --> 02:53.000]  Never gonna say goodbye
[02:53.000 --> 02:55.000]  Never gonna tell a lie
[02:55.000 --> 02:57.000]  And hurt you
[02:57.000 --> 02:59.000]  Never gonna give you up
[02:59.000 --> 03:01.000]  Never gonna let you down
[03:01.000 --> 03:05.000]  Never gonna run around and desert you
[03:05.000 --> 03:08.000]  Never gonna make you cry
[03:08.000 --> 03:10.000]  Never gonna say goodbye
[03:10.000 --> 03:12.000]  Never gonna tell a lie
[03:12.000 --> 03:14.000]  And hurt you
[03:14.000 --> 03:16.000]  Never gonna give you up
[03:16.000 --> 03:23.000]  If you want, never gonna let you down Never gonna run around and desert you
[03:23.000 --> 03:28.000]  Never gonna make you hide Never gonna say goodbye
[03:28.000 --> 03:42.000]  Never gonna tell you I ain't ready
```

## Api

```python
from transcribe_anything.api import transcribe

transcribe(
    url_or_file="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    output_dir="output_dir",
)
```

## Develop

Works for Ubuntu/MacOS/Win32(in git-bash)
This will create a virtual environment

```bash
> cd transcribe_anything
> ./install_dev.sh
# 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>`


# Tech Stack
  * OpenAI whisper
  * insanely-fast-whisper
  * yt-dlp: https://github.com/yt-dlp/yt-dlp
  * static-ffmpeg
    * github: https://github.com/zackees/static_ffmpeg
    * pypi: https://pypi.org/project/static-ffmpeg/

# Testing

  * Every commit is tested for standard linters and a batch of unit tests.

# Versions
  * 2.7.34: Various fixes.
  * 2.7.33: Fixes linux
  * 2.7.32: Fixes mac m1 and m2.
  * 2.7.31: Adds a warning if using python 3.12, which isn't supported yet in the backend.
  * 2.7.30: adds --query-gpu-json-path
  * 2.7.29: Made to json -> srt more robust for `--device insane`, bad entries will be skipped but warn.
  * 2.7.28: Fixes bad title fetching with weird characters.
  * 2.7.27: `pytorch-audio` upgrades broke this package. Upgrade to latest version to resolve.
  * 2.7.26: Add model option `distil-whisper/distil-large-v2`
  * 2.7.25: Windows (Linux/MacOS) bug with `--device insane` and python 3.11 installing wrong `insanely-fast-whisper` version.
  * 2.7.22: Fixes `transcribe-anything` on Linux.
  * 2.7.21: Tested that Mac Arm can run `--device insane`. Added tests to ensure this.
  * 2.7.20: Fixes wrong type being returned when speaker.json happens to be empty.
  * 2.7.19: speaker.json is now in plain json format instead of json5 format
  * 2.7.18: Fixes tests
  * 2.7.17: Fixes speaker.json nesting.
  * 2.7.16: Adds `--save_hf_token`
  * 2.7.15: Fixes 2.7.14 breakage.
  * 2.7.14: (Broken) Now generates `speaker.json` when diarization is enabled.
  * 2.7.13: Default diarization model is now pyannote/speaker-diarization-3.1
  * 2.7.12: Adds srt_swap for line breaks and improved isolated_environment usage.
  * 2.7.11: `--device insane` now generates a *.vtt translation file
  * 2.7.10: Better support for namespaced models. Trims text output in output json. Output json is now formatted with indents. SRT file is now printed out for `--device insane`
  * 2.7.9: All SRT translation errors fixed for `--device insane`. All tests pass.
  * 2.7.8: During error of `--device insane`, write out the error.json file into the destination.
  * 2.7.7: Better error messages during failure.
  * 2.7.6: Improved generation of out.txt, removes linebreaks.
  * 2.7.5: `--device insane` now generates better conforming srt files.
  * 2.7.3: Various fixes for the `insane` mode backend.
  * 2.7.0: Introduces an `insanely-fast-whisper`, enable by using `--device insane`
  * 2.6.0: GPU acceleration now happens automatically on Windows thanks to `isolated-environment`. This will also prevent
           interference with different versions of torch for other AI tools.
  * 2.5.0: `--model large` now aliases to `--model large-v3`. Use `--model large-legacy` to use original large model.
  * 2.4.0: pytorch updated to 2.1.2, gpu install script updated to same + cuda version is now 121.
  * 2.3.9: Fallback to `cpu` device if `gpu` device is not compatible.
  * 2.3.8: Fix --models arg which
  * 2.3.7: Critical fix: fixes dependency breakage with open-ai. Fixes windows use of embedded tool.
  * 2.3.6: Fixes typo in readme for installation instructions.
  * 2.3.5: Now has `--embed` to burn the subtitles into the video itself. Only works on local mp4 files at the moment.
  * 2.3.4: Removed `out.mp3` and instead use a temporary wav file, as that is faster to process. --no-keep-audio has now been removed.
  * 2.3.3: Fix case where there spaces in name (happens on windows)
  * 2.3.2: Fix windows transcoding error
  * 2.3.1: static-ffmpeg >= 2.5 now specified
  * 2.3.0: Now uses the official version of whisper ai
  * 2.2.1: "test_" is now prepended to all the different output folder names.
  * 2.2.0: Now explictly setting a language will put the file in a folder with that language name, allowing multi language passes without overwriting.
  * 2.1.2: yt-dlp pinned to new minimum version. Fixes downloading issues from old lib. Adds audio normalization by default.
  * 2.1.1: Updates keywords for easier pypi finding.
  * 2.1.0: Unknown args are now assumed to be for whisper and passed to it as-is. Fixes https://github.com/zackees/transcribe-anything/issues/3
  * 2.0.13: Now works with python 3.9
  * 2.0.12: Adds --device to argument parameters. This will default to CUDA if available, else CPU.
  * 2.0.11: Automatically deletes files in the out directory if they already exist.
  * 2.0.10: fixes local file issue https://github.com/zackees/transcribe-anything/issues/2
  * 2.0.9: fixes sanitization of path names for some youtube videos
  * 2.0.8: fix `--output_dir` not being respected.
  * 2.0.7: `install_cuda.sh` -> `install_cuda.py`
  * 2.0.6: Fixes twitter video fetching. --keep-audio -> --no-keep-audio
  * 2.0.5: Fix bad filename on trailing urls ending with /, adds --keep-audio
  * 2.0.3: GPU support is now added. Run the `install_cuda.sh` script to enable.
  * 2.0.2: Minor cleanup of file names (no more out.mp3.txt, it's now out.txt)
  * 2.0.1: Fixes missing dependencies and adds whisper option.
  * 2.0.0: New! Now a front end for Whisper ai!

## Notes:

  * Insanely Fast whisper for GPU
    * https://github.com/Vaibhavs10/insanely-fast-whisper
  * Fast Whisper for CPU
    * https://github.com/SYSTRAN/faster-whisper?tab=readme-ov-file
  * A better whisper CLI that supports more options but has a manual install.
    * https://github.com/ochen1/insanely-fast-whisper-cli/blob/main/requirements.txt
  * Subtitles translator:
    * https://github.com/TDHM/Subtitles-Translator
  * Forum post on how to avoid stuttering
    * https://community.openai.com/t/how-to-avoid-hallucinations-in-whisper-transcriptions/125300/23
  * More stable transcriptions:
    * https://github.com/jianfch/stable-ts?tab=readme-ov-file


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zackees/transcribe-anything",
    "name": "transcribe-anything",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10.0",
    "maintainer_email": null,
    "keywords": "transcription translation speech-to-text speech-recognition command-line-tool ai whisper ml anything",
    "author": "Zach Vorhies",
    "author_email": "dont@email.me",
    "download_url": "https://files.pythonhosted.org/packages/b1/f1/8d451f81a925a27c864b1e0391dc3aef03e226e0a951d7245d1d411befb4/transcribe-anything-2.7.34.tar.gz",
    "platform": null,
    "description": "# transcribe-anything\r\n[![MacOS_Tests](https://github.com/zackees/transcribe-anything/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/test_macos.yml)\r\n[![Win_Tests](https://github.com/zackees/transcribe-anything/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/test_win.yml)\r\n[![Ubuntu_Tests](https://github.com/zackees/transcribe-anything/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/test_ubuntu.yml)\r\n[![Lint](https://github.com/zackees/transcribe-anything/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/transcribe-anything/actions/workflows/lint.yml)\r\n\r\n![image](https://github.com/zackees/transcribe-anything/assets/6856673/94bdd1fe-3225-438a-ac1b-09c81f1d4108)\r\n\r\n\r\n### USES WHISPER AI\r\n\r\nOver 300+\u2b50's because this program this app just works! This whisper front-end app is the only one to generate a `speaker.json` file which partitions the conversation by who doing the speaking.\r\n\r\n[![Star History Chart](https://api.star-history.com/svg?repos=zackees/transcribe-anything&type=Date)](https://star-history.com/#zackees/transcribe-anything&Date)\r\n\r\nEasiest whisper implementation to install and use. Just install with `pip install transcribe-anything`. GPU acceleration is *automatic*, using the *blazingly* fast [insanely-fast-whisper](https://github.com/Vaibhavs10/insanely-fast-whisper) as the backend for `--device insane`. This is the only tool to optionally produces a `speaker.json` file, representing speaker-assigned text that has been de-chunkified.\r\n\r\nHardware acceleration on Windows/Linux/MacOS Arm (M1, M2, +) via `--device insane`\r\n\r\nInput a local file or youtube/rumble url and this tool will transcribe it using Whisper AI into subtitle files and raw text.\r\n\r\nUses whisper AI so this is state of the art translation service - completely free. \ud83e\udd2f\ud83e\udd2f\ud83e\udd2f\r\n\r\nYour data stays private and is not uploaded to any service.\r\n\r\nThe new version now has state of the art speed in transcriptions, thanks to the new backend `--device insane`, as well as producing a `speaker.json` file.\r\n\r\n\r\n\r\n```bash\r\npip install transcribe-anything\r\n# slow cpu mode, works everywhere\r\ntranscribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ\r\n# insanely fast using the insanely-fast-whisper backend.\r\ntranscribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device insane\r\n# translate from any language to english\r\ntranscribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ --device insane --task translate\r\n```\r\n\r\n\r\n\r\n#### Insanely fast on `cuda` platforms\r\n\r\nIf you pass in `--device insane` on a cuda platform then this tool will use this state of the art version of whisper: https://github.com/Vaibhavs10/insanely-fast-whisper, which is MUCH faster and has a pipeline for speaker identification (diarization) using the `--hf_token` option.\r\n\r\nAlso note, `insanely-fast-whisper` (`--device insane`) included in this project has been fixed to work with python 3.11. The upstream version is still broken on python 3.11 as of 1/22/2024.\r\n\r\n#### Speaker.json\r\n\r\nWhen diarization is enabled via `--hf_token` (hugging face token) then the output json will contain speaker info labeled as `SPEAKER_00`, `SPEAKER_01` etc. For licensing agreement reasons, you must get your own hugging face token if you want to enable this feature. Also there is an additional step to agree to the user policies for the `pyannote.audio` located here: https://huggingface.co/pyannote/segmentation-3.0. If you don't do this then you'll see runtime exceptions from `pyannote` when the `--hf_token` is used.\r\n\r\nWhat's special to this app is that we also generate a `speaker.json` which is a de-chunkified version of the output json speaker section.\r\n\r\n### speaker.json example:\r\n```json\r\n[\r\n  {\r\n    \"speaker\": \"SPEAKER_00\",\r\n    \"timestamp\": [\r\n      0.0,\r\n      7.44\r\n    ],\r\n    \"text\": \"for that. But welcome, Zach Vorhees. Great to have you back on. Thank you, Matt. Craving me back onto your show. Man, we got a lot to talk about.\",\r\n    \"reason\": \"beginning\"\r\n  },\r\n  {\r\n    \"speaker\": \"SPEAKER_01\",\r\n    \"timestamp\": [\r\n      7.44,\r\n      33.52\r\n    ],\r\n    \"text\": \"Oh, we do. 2023 was the year that OpenAI released, you know, chat GPT-4, which I think most people would say has surpassed average human intelligence, at least in test taking, perhaps not in, you know, reasoning and things like that. But it was a major year for AI. I think that most people are behind the curve on this. What's your take of what just happened in the last 12 months and what it means for the future of human cognition versus machine cognition?\",\r\n    \"reason\": \"speaker-switch\"\r\n  },\r\n  {\r\n    \"speaker\": \"SPEAKER_00\",\r\n    \"timestamp\": [\r\n      33.52,\r\n      44.08\r\n    ],\r\n    \"text\": \"Yeah. Well, you know, at the beginning of 2023, we had a pretty weak AI system, which was a chat GPT 3.5 turbo was the best that we had. And then between the beginning of last\",\r\n    \"reason\": \"speaker-switch\"\r\n  }\r\n]\r\n```\r\n\r\nNote that `speaker.json `is only generated when using `--device insane` and not for `--device cuda` nor `--device cpu`.\r\n\r\n#### `cuda` vs `insane`\r\n\r\nInsane mode eats up a lot of memory and it's common to get out of memory errors while transcribing. For example a 3060 12GB nividia card produced out of memory errors are common for big content. If you experience this then pass in `--batch-size 8` or smaller. Note that any arguments not recognized by `transcribe-anything` are passed onto the backend transcriber.\r\n\r\nAlso, please don't use `distil-whisper/distil-large-v2`, it produces extremely bad stuttering and it's not entirely clear why this is. I've had to switch it out of production environments because it's so bad. It's also non-deterministic so I think that somehow a fallback non-zero temperature is being used, which produces these stutterings.\r\n\r\n`cuda` is the original AI model supplied by openai. It's more stable but MUCH slower. It also won't produce a `speaker.json` file which looks like this:\r\n\r\n\r\n`--embed`. This app will optionally embed subtitles directly \"burned\" into an output video.\r\n\r\n# Install\r\n\r\nThis front end app for whisper boasts the easiest install in the whisper ecosystem thanks to [isolated-environment](https://pypi.org/project/isolated-environment/). You can simply install it with pip, like this:\r\n\r\n```bash\r\npip install transcribe-anything\r\n```\r\n\r\n# GPU Acceleration\r\n\r\nGPU acceleration will be automatically enabled for windows and linux. Mac users are stuck with `--device cpu` mode. But it's possible that `--device insane` and `--model mps` on Mac M1+ will work, but this has been completely untested.\r\n\r\n# Usage\r\n\r\n```bash\r\n transcribe-anything https://www.youtube.com/watch?v=dQw4w9WgXcQ\r\n```\r\n\r\nWill output:\r\n\r\n```\r\nDetecting language using up to the first 30 seconds. Use `--language` to specify the language\r\nDetected language: English\r\n[00:00.000 --> 00:27.000]  We're no strangers to love, you know the rules, and so do I\r\n[00:27.000 --> 00:31.000]  I've built commitments while I'm thinking of\r\n[00:31.000 --> 00:35.000]  You wouldn't get this from any other guy\r\n[00:35.000 --> 00:40.000]  I just wanna tell you how I'm feeling\r\n[00:40.000 --> 00:43.000]  Gotta make you understand\r\n[00:43.000 --> 00:45.000]  Never gonna give you up\r\n[00:45.000 --> 00:47.000]  Never gonna let you down\r\n[00:47.000 --> 00:51.000]  Never gonna run around and desert you\r\n[00:51.000 --> 00:53.000]  Never gonna make you cry\r\n[00:53.000 --> 00:55.000]  Never gonna say goodbye\r\n[00:55.000 --> 00:58.000]  Never gonna tell a lie\r\n[00:58.000 --> 01:00.000]  And hurt you\r\n[01:00.000 --> 01:04.000]  We've known each other for so long\r\n[01:04.000 --> 01:09.000]  Your heart's been aching but you're too shy to say it\r\n[01:09.000 --> 01:13.000]  Inside we both know what's been going on\r\n[01:13.000 --> 01:17.000]  We know the game and we're gonna play it\r\n[01:17.000 --> 01:22.000]  And if you ask me how I'm feeling\r\n[01:22.000 --> 01:25.000]  Don't tell me you're too much to see\r\n[01:25.000 --> 01:27.000]  Never gonna give you up\r\n[01:27.000 --> 01:29.000]  Never gonna let you down\r\n[01:29.000 --> 01:33.000]  Never gonna run around and desert you\r\n[01:33.000 --> 01:35.000]  Never gonna make you cry\r\n[01:35.000 --> 01:38.000]  Never gonna say goodbye\r\n[01:38.000 --> 01:40.000]  Never gonna tell a lie\r\n[01:40.000 --> 01:42.000]  And hurt you\r\n[01:42.000 --> 01:44.000]  Never gonna give you up\r\n[01:44.000 --> 01:46.000]  Never gonna let you down\r\n[01:46.000 --> 01:50.000]  Never gonna run around and desert you\r\n[01:50.000 --> 01:52.000]  Never gonna make you cry\r\n[01:52.000 --> 01:54.000]  Never gonna say goodbye\r\n[01:54.000 --> 01:57.000]  Never gonna tell a lie\r\n[01:57.000 --> 01:59.000]  And hurt you\r\n[02:08.000 --> 02:10.000]  Never gonna give\r\n[02:12.000 --> 02:14.000]  Never gonna give\r\n[02:16.000 --> 02:19.000]  We've known each other for so long\r\n[02:19.000 --> 02:24.000]  Your heart's been aching but you're too shy to say it\r\n[02:24.000 --> 02:28.000]  Inside we both know what's been going on\r\n[02:28.000 --> 02:32.000]  We know the game and we're gonna play it\r\n[02:32.000 --> 02:37.000]  I just wanna tell you how I'm feeling\r\n[02:37.000 --> 02:40.000]  Gotta make you understand\r\n[02:40.000 --> 02:42.000]  Never gonna give you up\r\n[02:42.000 --> 02:44.000]  Never gonna let you down\r\n[02:44.000 --> 02:48.000]  Never gonna run around and desert you\r\n[02:48.000 --> 02:50.000]  Never gonna make you cry\r\n[02:50.000 --> 02:53.000]  Never gonna say goodbye\r\n[02:53.000 --> 02:55.000]  Never gonna tell a lie\r\n[02:55.000 --> 02:57.000]  And hurt you\r\n[02:57.000 --> 02:59.000]  Never gonna give you up\r\n[02:59.000 --> 03:01.000]  Never gonna let you down\r\n[03:01.000 --> 03:05.000]  Never gonna run around and desert you\r\n[03:05.000 --> 03:08.000]  Never gonna make you cry\r\n[03:08.000 --> 03:10.000]  Never gonna say goodbye\r\n[03:10.000 --> 03:12.000]  Never gonna tell a lie\r\n[03:12.000 --> 03:14.000]  And hurt you\r\n[03:14.000 --> 03:16.000]  Never gonna give you up\r\n[03:16.000 --> 03:23.000]  If you want, never gonna let you down Never gonna run around and desert you\r\n[03:23.000 --> 03:28.000]  Never gonna make you hide Never gonna say goodbye\r\n[03:28.000 --> 03:42.000]  Never gonna tell you I ain't ready\r\n```\r\n\r\n## Api\r\n\r\n```python\r\nfrom transcribe_anything.api import transcribe\r\n\r\ntranscribe(\r\n    url_or_file=\"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\r\n    output_dir=\"output_dir\",\r\n)\r\n```\r\n\r\n## Develop\r\n\r\nWorks for Ubuntu/MacOS/Win32(in git-bash)\r\nThis will create a virtual environment\r\n\r\n```bash\r\n> cd transcribe_anything\r\n> ./install_dev.sh\r\n# Enter the environment:\r\n> source activate.sh\r\n```\r\n\r\nThe environment is now active and the next step will only install to the local python. If the terminal\r\nis closed then to get back into the environment `cd transcribe_anything` and execute `source activate.sh`\r\n\r\n## Required: Install to current python environment\r\n  * `pip install transcribe-anything`\r\n    * The command `transcribe_anything` will magically become available.\r\n  * `transcribe_anything <YOUTUBE_URL>`\r\n\r\n\r\n# Tech Stack\r\n  * OpenAI whisper\r\n  * insanely-fast-whisper\r\n  * yt-dlp: https://github.com/yt-dlp/yt-dlp\r\n  * static-ffmpeg\r\n    * github: https://github.com/zackees/static_ffmpeg\r\n    * pypi: https://pypi.org/project/static-ffmpeg/\r\n\r\n# Testing\r\n\r\n  * Every commit is tested for standard linters and a batch of unit tests.\r\n\r\n# Versions\r\n  * 2.7.34: Various fixes.\r\n  * 2.7.33: Fixes linux\r\n  * 2.7.32: Fixes mac m1 and m2.\r\n  * 2.7.31: Adds a warning if using python 3.12, which isn't supported yet in the backend.\r\n  * 2.7.30: adds --query-gpu-json-path\r\n  * 2.7.29: Made to json -> srt more robust for `--device insane`, bad entries will be skipped but warn.\r\n  * 2.7.28: Fixes bad title fetching with weird characters.\r\n  * 2.7.27: `pytorch-audio` upgrades broke this package. Upgrade to latest version to resolve.\r\n  * 2.7.26: Add model option `distil-whisper/distil-large-v2`\r\n  * 2.7.25: Windows (Linux/MacOS) bug with `--device insane` and python 3.11 installing wrong `insanely-fast-whisper` version.\r\n  * 2.7.22: Fixes `transcribe-anything` on Linux.\r\n  * 2.7.21: Tested that Mac Arm can run `--device insane`. Added tests to ensure this.\r\n  * 2.7.20: Fixes wrong type being returned when speaker.json happens to be empty.\r\n  * 2.7.19: speaker.json is now in plain json format instead of json5 format\r\n  * 2.7.18: Fixes tests\r\n  * 2.7.17: Fixes speaker.json nesting.\r\n  * 2.7.16: Adds `--save_hf_token`\r\n  * 2.7.15: Fixes 2.7.14 breakage.\r\n  * 2.7.14: (Broken) Now generates `speaker.json` when diarization is enabled.\r\n  * 2.7.13: Default diarization model is now pyannote/speaker-diarization-3.1\r\n  * 2.7.12: Adds srt_swap for line breaks and improved isolated_environment usage.\r\n  * 2.7.11: `--device insane` now generates a *.vtt translation file\r\n  * 2.7.10: Better support for namespaced models. Trims text output in output json. Output json is now formatted with indents. SRT file is now printed out for `--device insane`\r\n  * 2.7.9: All SRT translation errors fixed for `--device insane`. All tests pass.\r\n  * 2.7.8: During error of `--device insane`, write out the error.json file into the destination.\r\n  * 2.7.7: Better error messages during failure.\r\n  * 2.7.6: Improved generation of out.txt, removes linebreaks.\r\n  * 2.7.5: `--device insane` now generates better conforming srt files.\r\n  * 2.7.3: Various fixes for the `insane` mode backend.\r\n  * 2.7.0: Introduces an `insanely-fast-whisper`, enable by using `--device insane`\r\n  * 2.6.0: GPU acceleration now happens automatically on Windows thanks to `isolated-environment`. This will also prevent\r\n           interference with different versions of torch for other AI tools.\r\n  * 2.5.0: `--model large` now aliases to `--model large-v3`. Use `--model large-legacy` to use original large model.\r\n  * 2.4.0: pytorch updated to 2.1.2, gpu install script updated to same + cuda version is now 121.\r\n  * 2.3.9: Fallback to `cpu` device if `gpu` device is not compatible.\r\n  * 2.3.8: Fix --models arg which\r\n  * 2.3.7: Critical fix: fixes dependency breakage with open-ai. Fixes windows use of embedded tool.\r\n  * 2.3.6: Fixes typo in readme for installation instructions.\r\n  * 2.3.5: Now has `--embed` to burn the subtitles into the video itself. Only works on local mp4 files at the moment.\r\n  * 2.3.4: Removed `out.mp3` and instead use a temporary wav file, as that is faster to process. --no-keep-audio has now been removed.\r\n  * 2.3.3: Fix case where there spaces in name (happens on windows)\r\n  * 2.3.2: Fix windows transcoding error\r\n  * 2.3.1: static-ffmpeg >= 2.5 now specified\r\n  * 2.3.0: Now uses the official version of whisper ai\r\n  * 2.2.1: \"test_\" is now prepended to all the different output folder names.\r\n  * 2.2.0: Now explictly setting a language will put the file in a folder with that language name, allowing multi language passes without overwriting.\r\n  * 2.1.2: yt-dlp pinned to new minimum version. Fixes downloading issues from old lib. Adds audio normalization by default.\r\n  * 2.1.1: Updates keywords for easier pypi finding.\r\n  * 2.1.0: Unknown args are now assumed to be for whisper and passed to it as-is. Fixes https://github.com/zackees/transcribe-anything/issues/3\r\n  * 2.0.13: Now works with python 3.9\r\n  * 2.0.12: Adds --device to argument parameters. This will default to CUDA if available, else CPU.\r\n  * 2.0.11: Automatically deletes files in the out directory if they already exist.\r\n  * 2.0.10: fixes local file issue https://github.com/zackees/transcribe-anything/issues/2\r\n  * 2.0.9: fixes sanitization of path names for some youtube videos\r\n  * 2.0.8: fix `--output_dir` not being respected.\r\n  * 2.0.7: `install_cuda.sh` -> `install_cuda.py`\r\n  * 2.0.6: Fixes twitter video fetching. --keep-audio -> --no-keep-audio\r\n  * 2.0.5: Fix bad filename on trailing urls ending with /, adds --keep-audio\r\n  * 2.0.3: GPU support is now added. Run the `install_cuda.sh` script to enable.\r\n  * 2.0.2: Minor cleanup of file names (no more out.mp3.txt, it's now out.txt)\r\n  * 2.0.1: Fixes missing dependencies and adds whisper option.\r\n  * 2.0.0: New! Now a front end for Whisper ai!\r\n\r\n## Notes:\r\n\r\n  * Insanely Fast whisper for GPU\r\n    * https://github.com/Vaibhavs10/insanely-fast-whisper\r\n  * Fast Whisper for CPU\r\n    * https://github.com/SYSTRAN/faster-whisper?tab=readme-ov-file\r\n  * A better whisper CLI that supports more options but has a manual install.\r\n    * https://github.com/ochen1/insanely-fast-whisper-cli/blob/main/requirements.txt\r\n  * Subtitles translator:\r\n    * https://github.com/TDHM/Subtitles-Translator\r\n  * Forum post on how to avoid stuttering\r\n    * https://community.openai.com/t/how-to-avoid-hallucinations-in-whisper-transcriptions/125300/23\r\n  * More stable transcriptions:\r\n    * https://github.com/jianfch/stable-ts?tab=readme-ov-file\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Uses whisper AI to transcribe speach from video and audio files. Also accepts urls for youtube, rumble, bitchute, clear file, etc.",
    "version": "2.7.34",
    "project_urls": {
        "Homepage": "https://github.com/zackees/transcribe-anything"
    },
    "split_keywords": [
        "transcription",
        "translation",
        "speech-to-text",
        "speech-recognition",
        "command-line-tool",
        "ai",
        "whisper",
        "ml",
        "anything"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "04a8d466957b56600fc78c05a31901d7a6e817e0ee272c98e5dca3e965bfd679",
                "md5": "9d260cec0dd85d564473133a548e720f",
                "sha256": "049d491614b3af0584572c81f9fd5eec1032253fe1eaa12c86a755714eca5342"
            },
            "downloads": -1,
            "filename": "transcribe_anything-2.7.34-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d260cec0dd85d564473133a548e720f",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.10.0",
            "size": 32875,
            "upload_time": "2024-04-24T05:27:00",
            "upload_time_iso_8601": "2024-04-24T05:27:00.228221Z",
            "url": "https://files.pythonhosted.org/packages/04/a8/d466957b56600fc78c05a31901d7a6e817e0ee272c98e5dca3e965bfd679/transcribe_anything-2.7.34-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1f18d451f81a925a27c864b1e0391dc3aef03e226e0a951d7245d1d411befb4",
                "md5": "9be82e3abb5e7f614cfa20452d0cc82d",
                "sha256": "6d9604cfd7dbe6fac3c9c32c580d240b8f64caf5d187263fcc4c84acabdb68f9"
            },
            "downloads": -1,
            "filename": "transcribe-anything-2.7.34.tar.gz",
            "has_sig": false,
            "md5_digest": "9be82e3abb5e7f614cfa20452d0cc82d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10.0",
            "size": 34830,
            "upload_time": "2024-04-24T05:27:02",
            "upload_time_iso_8601": "2024-04-24T05:27:02.976987Z",
            "url": "https://files.pythonhosted.org/packages/b1/f1/8d451f81a925a27c864b1e0391dc3aef03e226e0a951d7245d1d411befb4/transcribe-anything-2.7.34.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 05:27:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zackees",
    "github_project": "transcribe-anything",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "static-ffmpeg",
            "specs": [
                [
                    ">=",
                    "2.7"
                ]
            ]
        },
        {
            "name": "yt-dlp",
            "specs": [
                [
                    ">=",
                    "2023.3.4"
                ]
            ]
        },
        {
            "name": "appdirs",
            "specs": [
                [
                    "==",
                    "1.4.4"
                ]
            ]
        },
        {
            "name": "disklru",
            "specs": [
                [
                    ">=",
                    "1.0.7"
                ]
            ]
        },
        {
            "name": "isolated-environment",
            "specs": [
                [
                    "~=",
                    "1.3.4"
                ]
            ]
        },
        {
            "name": "FileLock",
            "specs": []
        },
        {
            "name": "webvtt-py",
            "specs": [
                [
                    "==",
                    "0.4.6"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "transcribe-anything"
}
        
Elapsed time: 0.25950s