Github – : Fantasypl


Download and Installation Workflow Usage 6.1 Typical usage 6.1.4 Transcribe Audio To Subtitles FAQ

Click up arrow to go back to TOC.

Đang xem: Github


Autosub is an automatic subtitles generating utility. It can detect speech regions automatically by using Auditok, split the audio files according to regions by using ffmpeg, transcribe speech based on several APIs and translate the subtitles” text by using py-googletrans.

The new features mentioned above are only available in the latest alpha branch. Not available on PyPI or the original repo.


This repo has a different license from the original repo.




Autosub depends on these third party softwares or Python site-packages. Much appreciation to all of these projects.

Others see: requirements.txt.

About how to install these dependencies, see Download and Installation.


Download and Installation

Except the PyPI version, others include non-original codes not from the original repository.

After autosub-0.4.0, all of the codes is compatible with both Python 2.7 and Python 3. It don”t matter if you change the Python version in the installation commands below.

About the dependencies installation. If you install autosub by pip, ffmpeg and ffmpeg-normalize won”t be installed together not like the Python site-packages already listed on the or requirements.txt. You need to install them separately. But of course they are optional. They aren”t necessary if you only use autosub to translate your subtitles.

ffmpeg, ffprobe, ffmpeg-normalize need to be put on one of these places to let the autosub detect and use them. The following codes are in the Priority is determined in order.

Set the following environment variables before running the program: FFMPEG_PATH, FFPROBE_PATH and FFMPEG_NORMALIZE_PATH. It will override the ones located at the environment variable PATH. This will be helpful if you don”t want to use the one in the PATH. Add them to the environment variable PATH. No need to worry about if using package manager to install such as using pip to install ffmpeg-normalize and using chocolatey to install ffmpeg. Add them to the same directory as the autosub executable. Add them to the current command line working directory.

About the git installation. If you don”t want to install git to use pip VCS support to install python package or just confused with git environment variables, you can manually click that clone and download button to download the source code and use pip to install the source code locally by input these commands.

Due to the autosub PyPI project is maintained by the original autosub repo”s owner, I can”t modify it or upload a project with the same name. Perhaps later when this version of autosub becomes stabler, I will rename and duplicate this repo and then upload it to PyPI.


alpha branch

origin branch

dev branch

The latest codes will be pushed to this branch. If it works fine, it will be merged to alpha branch when new version released. Only used to test or pull request. Don”t install them unless you know what you are doing.


Install on Ubuntu

Include dependencies installation commands.

Install from alpha branch.(latest autosub alpha release)

apt install ffmpeg python python-pip git -y pip install git+

apt install ffmpeg python python-pip git -y pip install git+
Recommend using python3 and python-pip3 instead of python and python-pip after autosub-0.4.0.


Install on Windows

You can just go to the release page and download the latest release for Windows. The click-and-run batches are also in the package. You can manually edit by using Notepad++. Or add the executable files” directory to system environment variables so you can use it as a universal command everywhere in the system if permission is Ok.

Tips: Shift – Right Click is the keyboard shortcut for opening a Powershell on current directory. To open an exe at current directory, the format is like .autosub.

Or you can just directly open it and input the args manually though I don”t recommend doing this due to its less efficiency.

The one without pyinstaller suffix is compiled by Nuitka. It”s faster than the pyinstaller due to its compiling feature different from pyinstaller which just bundles the application. If there”s anything wrong on the both releases, or the package size and any other things are annoying you, you can just use the traditional pip installation method below.

Or install Python environment(if you still don”t have one) from choco and then install the package.

Xem thêm: coincide là gì

Recommend using chocolatey on windows to install the environment and dependencies.

Choco installation command is for cmd.(not Powershell)

PyPI version(autosub-0.3.12) is not recommended using on windows because it just can”t run successfully. See the changelog on the origin branch and you will know the details.

Recommend using python instead of python2 autosub-0.4.0.




A video/audio/subtitles file.

If it is a video or audio file, use ffmpeg to convert the format into the proper one for API. Any format supported by ffmpeg is OK to input, but the output or processed format for API is limited by API and autosub codes.

Supported formats below:


24bit/44100Hz/mono FLAC(default) Other format like OGG_OPUS isn”t supported by API. (I”ve tried modifying requests headers or json requests and it just didn”t work) Or format like PCM has less bits per sample but more storage usage than FLAC. Although the API support it but I think it”s unnecessary to modify codes to support it.

Google Cloud Speech-to-Text API v1p1beta1

Supported 24bit/44100Hz/mono FLAC(default) Supported but not default args (more info on Transcribe Audio To Subtitles) 8000Hz|12000Hz|16000Hz|24000Hz|48000Hz/mono OGG_OPUS MP3 16bit/mono PCM

Also, you can use the built-in audio pre-processing function though Google doesn”t recommend doing this. Honestly speaking, if your audio volume is not been standardized like too loud or too quiet, it”s recommended to use some tools or just the built-in function to standardize it. The default pre-processing commands depend on the ffmpeg-normalize and ffmpeg. The commands include three commands. The first is for converting stereo to mono. The second is for filtering out the sound not in the frequency of speech. The third is to normalize the audio to make sure it is not too loud or too quiet. If you are not satisfied with the default commands, you can also modified them yourself by input -apc option. Still, it currently only supports 24bit/44100Hz/mono FLAC format.

If it is a subtitles file and you give the proper arguments, only translate it by py-googletrans.


Audio length limits:


Google Cloud Speech-to-Text API

Currently only support sync-recognize means only short-term audio supported.

Autosub uses Auditok to detect speech regions. And then use them to split as well as convert the video/audio into many audio fragments. Each fragment per region per API request. All these audio fragments are converted directly from input to avoid any extra quality loss.

Or uses external regions from the file that pysubs2 supports like .ass or .srt. This will allow you to manually adjust the regions to get better recognition result.

Speech-to-Text/Translation API request

Makes parallel requests to generate transcriptions for those regions. One audio fragment per request. Recognition speed mostly depends on your network upload speed.

Manually post-processing for the subtitles lines may be needed, some of which are too long to be fitted in a single line at the bottom of the video frame.

After Speech-to-Text, translates them to a different language. Combining multiple lines of text to a chunk of text to request for result. Details at issue #49. And finally saves the result subtitles to the local storage.


Speech-to-Text/Translation language support

The Speech-to-Text lang codes are different from the Translation lang codes due to the difference between these two APIs. And of course, they are in Google formats, not following the iso standards, making users more confused to use.

To solve this problem, autosub uses langcodes to detect input lang code and convert it to a best match according to the lang code lists. Default it won”t be enabled. To enable it in different phases, use -bm all option.

To manually match or see the full list of the lang codes, run the utility with the argument -lsc/–list-speech-codes and -ltc/ –list-translation-codes. Or open and check.

To get the language of the first line of the subtitles file, you can use -dsl to detect.

Currently, autosub allows to send the lang codes not from the –list-speech-codes, which means in this case the program won”t stop.



Currently support the following formats to output.

Xem thêm: Sơn Acrylic Là Gì ? Ứng Dụng Của Nó Trong Đời Sống Là Gì? Sơn Acrylic Là Gì

OUTPUT_FORMAT = { “srt”: “SubRip”, “ass”: “Advanced SubStation Alpha”, “ssa”: “SubStation Alpha”, “sub”: “MicroDVD Subtitle”, “mpl2.txt”: “Similar to MicroDVD”, “tmp”: “TMP Player Subtitle Format”, “vtt”: “WebVTT”, “json”: “json(Only times and text)”, “ass.json”: “json(Complex ass content json)”, “txt”: “Plain Text(Text or times)” }
Or other subtitles types/output modes, depend on what you need. More info in help message.

DEFAULT_MODE_SET = { “regions”, “src”, “full-src”, “dst”, “bilingual”, “dst-lf-src”, “src-lf-dst” }

Related Posts