Skip to main content

Creates Video Subtitles

Project description

video-subtitles

Adds subtitles to a movie.

Linting

MacOS_Tests Ubuntu_Tests Win_Tests

Run tox until it's correct.

To develop software, run . ./activate.sh

Install

Install Python 3.10

Install videosubtitles tool

  • Open up a windows command terminal
    • Hit the "Windows Key" + r
    • type in cmd and hit enter on the keyboard
    • type in pip install video-subtitles
    • Close the windows command terminal

It should now be installed.

First run

  • Keep in mind that the first run will take a lot of time as it downloads the proper drivers for your computer. But this will only be done once. Also there is an API key that you will be asked about, you can skip this by putting in free as the key.

Running

  • Open up a windows command terminal, as described in the previous step
  • cd to your video directory where you video is at
  • type in the following videosubtitles myvideo.mp4 --languages es,fr,zh,it
    • This will generate English, French, Chinese, Italian subtitles
    • For other subtitle languages see the language reference below
  • On the first run, you will be asked to enter in an API key from DeepL, the english -> Language X translation service. This KEY is free for upto 500,000 characters per month. If you don't like this then you can use the word free instead and special code will attempt to interact with the website and use point and clicks to get free translations. However this is extremely slow as pages need to be clicked by a bot. Also the translations are uploaded in chunks so you might get weird translations at the cutoff point. While the API key will be lightning fast and the translations have been verified to be excellent quality. Also, this free mode may break unexpectadly in the future.
  • After the translations are done, you'll get a new folder that is the name of the video with "test_" prepended to it. So myvideo.mp4 will generate a "text_myvideo" with srt files for all the languages
    • in the example above, you would get
      • text_myvideo/en.srt
      • text_myvideo/es.srt
      • text_myvideo/fr.srt
      • text_myvideo/zh.srt
      • text_myvideo/it.srt

How it works

  • Translation from audio -> en.srt is performed by transcribe-anything
    • Sadly, transcribe-anything can only translate to english subtitles.
  • After the english is generated, DeepL is used as a backend service to translate to english to all other languages.

Language Reference

Short hand language codes

af,am,ar,as,az,ba,be,bg,bn,bo,br,bs,ca,cs,cy,da,
de,el,en,es,et,eu,fa,fi,fo,fr,gl,gu,ha,haw,he,hi,
hr,ht,hu,hy,id,is,it,ja,jw,ka,kk,km,kn,ko,la,lb,
ln,lo,lt,lv,mg,mi,mk,ml,mn,mr,ms,mt,my,ne,nl,nn,
no,oc,pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,sn,so,sq,
sr,su,sv,sw,ta,te,tg,th,tk,tl,tr,tt,uk,ur,uz,vi,
yi,yo,zh

Full Language codes will also work

Afrikaans,Albanian,Amharic,Arabic,Armenian,Assamese,Azerbaijani,
Bashkir,Basque,Belarusian,Bengali,Bosnian,Breton,Bulgarian,Burmese,
Castilian,Catalan,Chinese,Croatian,Czech,Danish,Dutch,English,
Estonian,Faroese,Finnish,Flemish,French,Galician,Georgian,German,
Greek,Gujarati,Haitian,Haitian Creole,Hausa,Hawaiian,Hebrew,Hindi,
Hungarian,Icelandic,Indonesian,Italian,Japanese,Javanese,Kannada,
Kazakh,Khmer,Korean,Lao,Latin,Latvian,Letzeburgesch,Lingala,
Lithuanian,Luxembourgish,Macedonian,Malagasy,Malay,Malayalam,
Maltese,Maori,Marathi,Moldavian,Moldovan,Mongolian,Myanmar,Nepali,
Norwegian,Nynorsk,Occitan,Panjabi,Pashto,Persian,Polish,Portuguese,
Punjabi,Pushto,Romanian,Russian,Sanskrit,Serbian,Shona,Sindhi,
Sinhala,Sinhalese,Slovak,Slovenian,Somali,Spanish,Sundanese,Swahili,
Swedish,Tagalog,Tajik,Tamil,Tatar,Telugu,Thai,Tibetan,Turkish,
Turkmen,Ukrainian,Urdu,Uzbek,Valencian,Vietnamese,Welsh,Yiddish,
Yoruba

Windows

This environment requires you to use git-bash.

Linting

Run ./lint.sh to find linting errors using ruff, pylint, flake8 and mypy.

Releases

  • 1.0.1: Adds retry to translation step. Also alerts when the video is done.
  • 1.0.0: Initial release

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

video-subtitles-1.0.1.tar.gz (328.2 kB view details)

Uploaded Source

Built Distribution

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

video_subtitles-1.0.1-py2.py3-none-any.whl (10.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file video-subtitles-1.0.1.tar.gz.

File metadata

  • Download URL: video-subtitles-1.0.1.tar.gz
  • Upload date:
  • Size: 328.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for video-subtitles-1.0.1.tar.gz
Algorithm Hash digest
SHA256 35bc7bb2c001f25b8187b517b4ccd8a196f7eef8cb3ce239fa9e7bf5a36c799e
MD5 1f34ed4ffa7f4b6489d4c68162b34549
BLAKE2b-256 085e84f7b821ee28d8af1c677d0677a9059af7b52e1b5c90f3d9085bfefe47de

See more details on using hashes here.

File details

Details for the file video_subtitles-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for video_subtitles-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6bc37e484a8f36f1f82074b94f7b414d3c2dc5d83df19a73b3270140aa4fe30a
MD5 7445126c01b40d4d80e05c42799c21f8
BLAKE2b-256 38b1b5c6d5d99f8f63a251df1e5da056213015e71f5abf175d055ad2839a2d55

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