Edit subtitles in your terminal instead of a text editor.
Project description
subtitle-editor
Basic usage:
# Works with srt files
subtitle-editor video.mp4 subtitles.srt
# Can take plaintext files as input
subtitle-editor video.mp4 subtitles.srt --input lyrics.txt
See the Tutorial for details.
Setup (Mac OS)
Install dependencies
- Install Homebrew
- Install system dependencies (get a coffee while this runs)
brew install ffmpeg pyenv portaudio
- Finalize your pyenv installation For zsh (standard in newer Macs) this will be:
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile echo 'eval "$(pyenv init -)"' >> ~/.zshrc
- Install python 3
pyenv install 3.7.11 # Or another python 3 version pyenv global 3.7.11
- Update pip (don't skip this)
pip install -U pip
Install subtitle-editor
pip install subtitle-editor
Tutorial: Add subtitles to a video
-
Create a plain text file that contains each subtitle on a separate line. Blank lines will be ignored. For example:
This is the first line This is the second line And so on
-
Import this file into subtitle-editor
cd /path/to/video/project subtitle-editor video.mp4 video.srt --input input.txt
The subtitle-editor will pre-render the frames of your video. Note: if video.srt already exists it will be overwritten.
-
Now you will create a rough cut of the subtitles. The idea here is to get your timestamps more or less right; you'll do a second pass to clean everything up later.
Type
P
to start playback, then press the spacebar to set the currently-selected timestamp and move to the next one. Keep going until you get to the end. -
Type
q
to save your work and exit to the terminal.video.srt
now exists with your rough cut of subtitles! -
Run subtitle-editor again, but without passing an input. This will allow you to edit the existing subtitle file.
subtitle-editor video.mp4 video.srt
-
For each subtitle, type
p
to play the video & audio for that subtitle. Use↑/↓/←/→
to navigate between subtitles and start/end times. Use-/_
and=/+
to modify the times until they are correct. -
Navigate back to the beginning and type
P
to play back the whole video with subtitles. If there are any issues, typep
to pause and make adjustments, then pressP
to resume playback. -
Type
q
to save your work and exit!
Command Reference
When you are using subtitle-editor, you have the following commands available.
Navigation
<tab>/←/→ Switch between start/end timestamps
↑/↓ Select a subtitle
=/+ Increase the selected timestamp by one frame / 1 sec
-/_ Decrease the selected timestamp by one frame / 1 sec
Playback
P Enter / leave playback mode
<space> In playback mode, set the current timestamp and move to the next one
u In playback mode, "undo" by moving back one timestamp (does not
actually undo the change)
p In standard mode, play the video between the start/end timestamps
of the current subtitle
Other
q Save and exit
Ctrl + c Exit without saving
? Display help message
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
Built Distribution
File details
Details for the file subtitle-editor-0.3.0.tar.gz
.
File metadata
- Download URL: subtitle-editor-0.3.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.1 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a30a2cc5b4b56a7adfafb15af76a5f9bfaa94217cd756d66de32e500f3c5fd12 |
|
MD5 | bfa1df2fddbccb92c6bc4faa7bbb987b |
|
BLAKE2b-256 | de420412427ea9cb086473a387f00634d1ec2fb288b0b241841b842067788f8a |
File details
Details for the file subtitle_editor-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: subtitle_editor-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.1 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f2a7498c86e0db3d7f68ec2f1667b4cef008cbbde2a8c7ffa342f27b92f861 |
|
MD5 | df917885579729f6e48e620157faf954 |
|
BLAKE2b-256 | 9e4eab219a96411ab4bb91220b65db4bc65be43bb2effb230ca50cfb748077c4 |