https://github.com/eggplants/subt
Translate a subtitle file
https://github.com/eggplants/subt
Last synced: about 1 year ago
JSON representation
Translate a subtitle file
- Host: GitHub
- URL: https://github.com/eggplants/subt
- Owner: eggplants
- License: mit
- Created: 2024-07-27T22:03:44.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-09T17:17:20.000Z (over 1 year ago)
- Last Synced: 2024-11-27T05:32:53.569Z (over 1 year ago)
- Language: Python
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# subt
[](
) [](
) [](
)
[](
) [](
)
[ ](
)
Translate a subtitle file
## Install
```sh
pip install subt
# or
pipx install subt
```
## Run
(Optional) Generate an example .srt file from Me at the zoo
```shellsession
$ yt-dlp 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
$ whisper-ctranslate2 'Me at the zoo [jNQXAC9IVRw].mp4'
$ cat 'Me at the zoo [jNQXAC9IVRw].srt'
1
00:00:00,000 --> 00:00:05,000
Alright, so here we are, one of the elephants.
2
00:00:05,000 --> 00:00:13,000
The cool thing about these guys is that they have really, really, really long trunks.
3
00:00:13,000 --> 00:00:16,000
And that's cool.
4
00:00:16,000 --> 00:00:19,000
And that's pretty much all there is to say.
```
Then:
```shellsession
$ subt 'Me at the zoo [jNQXAC9IVRw].srt' -d ja
Saved: './Me at the zoo [jNQXAC9IVRw].translated.srt'
$ cat 'Me at the zoo [jNQXAC9IVRw].translated.srt'
1
00:00:00,000 --> 00:00:05,000
さて、ここに私たちは象の一人です。
2
00:00:05,000 --> 00:00:13,000
これらの人のクールなことは、彼らが本当に、本当に、本当に長い幹を持っているということです。
3
00:00:13,000 --> 00:00:16,000
そして、それはクールです。
4
00:00:16,000 --> 00:00:19,000
そして、それはほとんどすべてです。
```
## Help
```shellsession
$ subt -h
usage: subt [-h] [-S SERVICE] [-s LANG] [-d LANG] [-V] sub_file
Translate a subtitle file
positional arguments:
sub_file
options:
-h, --help show this help message and exit
-S SERVICE service to translate (default: google)
-s LANG source language (default: auto)
-d LANG destination language (default: en)
-V, --version show program's version number and exit
```
## License
MIT