Showing posts with label plex. Show all posts
Showing posts with label plex. Show all posts

Saturday, February 22, 2014

SubRip Subtitles Time Adjustment Tool

I have been working on updating my Plex movie database with SubRip Subtitle (.srt) files from OpenSubtitles.org. One of the subtitle files I downloaded had the timing off from the voices. Very distracting.

OpenSubtitles.org - the biggest open subtitles database - http://www.opensubtitles.org/en
So I wrote up a Python script to adjust the timings of the .srt file and posted it to GitHub. You pass the movie .srt file and the time shift, and it outputs the modified subtitle file.
git clone https://github.com/oeey/srtshift

python srtshift/srtshift.py movie.srt 2.5 > movie_fixed.srt

# play movie and check subtitle timing, the commit the change with
mv movie_fixed.srt movie.srt

SubRip Subtitles

SubRip is a "software program for Windows which "rips" (extracts) subtitles and their timings from video.  SubRip is also the name of the widely used and broadly compatible subtitle text file format created by this software."

SubRip files are named with an extension .srt.

Formatting

SubRip files are formatted with:
  1. A numeric counter identifying each sequential subtitle
  2. The time that the subtitle should appear on the screen, followed by --> and the time it should disappear
  3. Subtitle text itself on one or more lines
  4. A blank line containing no text, indicating the end of this subtitle

Example

1
00:00:10,500 --> 00:00:13,000
Elephant's Dream

2
00:00:15,000 --> 00:00:18,000
At the left we can see...

Download

The SubRip subtitle files can be downloaded online from a variety of sites.  My personal favorites are:


Plex

To have Plex Media Server work with SubRip (.srt) files, simply name the srt file the same as the movie file name with a '.eng.srt' (for English) extension.  Plex will automatically pick up the Subtitle file on the next Library refresh.

For example:
Frozen.mp4
Frozen.eng.srt

Extracting

If you can't find the subtitle file online, and you have the DVD, the SubRip Windows software can actually extract the subtitles from the DVD.  Unlike Closed Captions, Subtitles are not stored as text on DVDs, but as bitmap images.  SubRip uses OCR technology to convert the images to text.  This does require work on your part.  As the OCR scanner finds new unrecognized characters it will ask you translate them.


Plex Media Server



Plex Media Server (http://plex.tv/) "bridges the gap between your computer and your home theater, doing so with a visually appealing user interface that provides instant access to your media."

Plex allows you to play your collection of movies, music and photos from a variety of devices, such as a computer, Smart TV, Roku, cell phones, tablets and others.  Through the online Plex Service you can also share your media collection with friends and family.

Plex has a server download for Windows, Linux and Mac.  I have had the best results (least issues) with the Linux 64bit version.



Plex Installation

Plex is really easy to install.  Plex can be downloaded from https://plex.tv/downloads

For Windows, you run the simple installer executable.

For Linux, you download the appropriate rpm/deb.  The following example works for Fedora 14 or CentOS 6 (or newer) 64bit

# as the root user...

wget http://downloads.plexapp.com/plex-media-server/0.9.8.18.290-11b7fdd/plexmediaserver-0.9.8.18.290-11b7fdd.x86_64.rpm

rpm -Uvh plexmediaserver-0.9.8.18.290-11b7fdd.x86_64.rpm

service plexmediaserver restart

To access the Plex web interface visit http://127.0.0.1:32400/web/

To use the online Plex Service you will need to open up port 32400 on your firewall.