Skip to main content

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.

Demo image

Setup (Mac OS)

Install dependencies

  1. Install Homebrew
  2. Install system dependencies (get a coffee while this runs)
    brew install ffmpeg pyenv portaudio
    
  3. Finalize your pyenv installation For zsh (standard in newer Macs) this will be:
    echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
    
    echo 'eval "$(pyenv init -)"' >> ~/.zshrc
    
  4. Install python 3
    pyenv install 3.7.11  # Or another python 3 version
    pyenv global 3.7.11
    
  5. Update pip (don't skip this)
    pip install -U pip
    

Install subtitle-editor

pip install subtitle-editor

Tutorial: Add subtitles to a video

  1. 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
    
  2. 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.

  3. 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.

  4. Type q to save your work and exit to the terminal. video.srt now exists with your rough cut of subtitles!

  5. 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
    
  6. 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.

  7. Navigate back to the beginning and type P to play back the whole video with subtitles. If there are any issues, type p to pause and make adjustments, then press P to resume playback.

  8. 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

subtitle-editor-0.3.0.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

subtitle_editor-0.3.0-py2.py3-none-any.whl (24.5 kB view details)

Uploaded Python 2 Python 3

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

Hashes for subtitle-editor-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a30a2cc5b4b56a7adfafb15af76a5f9bfaa94217cd756d66de32e500f3c5fd12
MD5 bfa1df2fddbccb92c6bc4faa7bbb987b
BLAKE2b-256 de420412427ea9cb086473a387f00634d1ec2fb288b0b241841b842067788f8a

See more details on using hashes here.

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

Hashes for subtitle_editor-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c2f2a7498c86e0db3d7f68ec2f1667b4cef008cbbde2a8c7ffa342f27b92f861
MD5 df917885579729f6e48e620157faf954
BLAKE2b-256 9e4eab219a96411ab4bb91220b65db4bc65be43bb2effb230ca50cfb748077c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page