Skip to content

carl-vbn/subtitle-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

subtitle-generator

A Python app that automatically creates subtitle for any video/audio file as long as a transcript is provided. The program uses lowerquality's "gentle" forced aligner to retrieve the timings of the words.
I explained the program and the process of making it in a video on my YouTube channel:
video_thumbnail

How to install (only tested on Linux)

  1. Clone this repository
  2. Clone gentle into a subfolder called "gentle" inside the local repository
  3. Run gentle's install.sh script (I've had problems with it not installing every dependency automatically, so you may have to try it a few times while installing the missing dependencies using apt-get install
  4. Paste your desired font at the root of the subtitle-generator repository (same folder as subtitle_generator.py)
  5. Make sure you have PIL and ffmpeg-python installed using pip

How to use

  1. Edit subtitle_generator.pyin any IDE/Text editor and changes the UPPERCASE variables at the top (don't forget to set the right font!)
  2. Run the subtitle_generator.py script with the necessary arguments

Arguments

  • --input The input file (video or audio) for which the subtitles should be generated [Default value: "video.mp4"]
  • --outputThe output file (will be a .mp4 video file) [Default value: "output.mp4"]
  • --start_frameThe frame at which the program will start to generate subtitles [Default: 0]
  • --end_frameThe frame at which the program will cease to generate subtitles [Default: last frame]
  • --framerateThe framerate of the input video (ignore if it's just an audio file) [Default: 60]
  • --widthand --heightThe dimensions of the input video (ignore if it's just an audio file) [Default: 1920x1080]
  • --clear_existingIf specified, the program will delete all previously generated frames saved inside the image sequence output directory
  • --overlayIf specified, the output file will be the input file + the subtitles. If it isn't, the output file will just be the subtitles on a green background, which can then be easily edited on top of the video. This option is not recommended as the video will be unusable if the specified dimensions are wrong (while the green background video offers more flexibility), and currently it seems like audio is lost in the process.
  • --cache_subtitlesand load_subtitleshave not yet been implemented.

About

A Python app that can automatically add subtitles to any video as long as a transcript is provided

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages