Editing subtitles on Linux 

http://shreevatsa.wordpress.com/2006/12/01/editing-subtitles-on-linux/

December 1st, 2006

Editing subtitles on Linux 

First, the not-so-good ones 

There is Ksubtile (note: it's not Ksubtitle!) which is a KDE app. It handles only SRTs (but I think it can import from other formats), and doesn't even seem to have a way to change the framerate. Pretty useless, but if you want it, the package's name is ksubtile. Then there is gsubedit, but it hasn't released a stable version since June 2002, so I'm guessing it's dead (or it's perfect ;-)).

Then the good ones 

But what is alive and good is subtitleeditor. debuntu.org has written a couple of articles and has it in its repository. Subtitleeditor seems to have almost everything one could possibly ask for (including spell-check and Find/Replace!). Update: subtitleeditor is available in universe on edgy; no need for an "outside" repository.

I also discovered gaupol, which seems to be much better. Because I hadn't used subtitleditor much, I didn't realise how many badly needed features are missing in it (especially Undo). The edgy repos have gaupol too (but it's slightly broken).

Also recently added is libsubtitles-perl, which comes with a commandline tool called subs… it's already my favourite :-)

Other things to do 

If you want to make your own subtitles, the tutorials Subtiteling with Linux and Linux Digital Fansubbing Guide might help. http://janl.langfeldt.net/subtiteling/ http://dominia.org/djao/dvdsub.html

For rudimentary tasks, it may not even be necessary to install anything: there is an Online Subtitle Synchronizer / FPS & Format Converter. http://subtitle-synchronizer.sleytr.net/

BTW, there's one thing I'd very much like to know: Is there any hope at all for removing hard subtitles? Maybe some kind of clever pattern recognition and then filling the region with the local background colour? Something? :-(

(Update: I must try Subrip, AVISubDetector and Subtitle Workshop sometime… I think they promise to extract the subtitles from the video stream, but I don't know if this means they can remove them…) In the meantime, mplayer has a "delogo" filter, intended for detecting fixed logos and removing them. It works, somewhat — it replaces the subtitles and interpolates from the surroundings, but leaves a rectangle which is somewhat blurred. For one particular video, I used -vf delogo=120:250:400:70:-1,expand=:::::4/3, or -vf expand=:::::4/3,delogo=120:320:400:70:-1. The parameters are x:y:w:h:t, where (x,y) are the coordinates of the top-left of the rectangle, and w and h its width and height. Remove the -1 after you have the right rectangle; it's for a green border.

Some general info on subtitles (I use mplayer):

Sync 

If the subtitle and audio are out of sync, first try using the `z` and `x` keys till you get them in sync. `z` rewinds (delays) the subtitles (makes them come later wrt the audio) (recalls subtitles that already went by), and `x` prepones the subtitles (makes the subtitles come earlier, gets subtitles from future). (Perversely, for reasons I don't yet know, mplayer calls the former a negative "sub delay" and the latter a positive sub delay.)

If after some time they start falling out of sync again (one quick way to check is to seek forward or backward a few minutes and check if they are still in sync), then the problem is probably that the video and subtitles have different framerates (fps). To fix this, you must run mplayer with -subfps [correct_fps]. You might be able to find the correct fps at the place you downloaded the subtitle from ;-); else simply try the three values 23.976, 25, and 29.97; which work in most cases. (If *that* doesn't work, try all three values for the video as well (-fps [value]). One of the nine pairs should hopefully work!)

Subtitle Placement 

`r` raises the subtitle, and `t` lowers it. (Or you could also start mplayer with -subpos [value])

I used to wonder whether it was possible to have the subtitles not covering the actual movie (there was usually some blank area below and above the actual movie content…), and I just discovered that it is! Basically, you have to expand the video so that some blank space is part of it, and then `r` and `t` will go into that blank space. Using -vf expand=0:-50:0:0 adds a 50-pixel blank space at the bottom of the video. (Leaving out the 0:0 and using only -vf expand=0:-50 adds the 50 pixels but centres the video, so that there are 25-pixel bars at the top and bottom.) Another way to get blank space would be to use -vf expand=:::::4/3 which means "Expand the video so that the aspect ratio is 4/3". In fact, it may be a good idea to add either vf=expand=0:-50:0:0 or vf=expand=:::::4/3 to ~/.mplayer/config.

documented on: 2007.07.30

Subtitle Editor for Linux 

http://appdir.org/2007/07/10/subtitle-editor-for-linux/

appdir.org, July 10, 2007

Here's my favorite subtitle editor for Linux. It includes Gaupol, Subtitle Editor, Gnome Subtitles, GSubEdit, KSubtile, Jubler, etc. If you are a movie fan, this should very helpful.

Gaupol 

 Interface: GTK+
 Website: http://home.gna.org/gaupol/[]
Current version: 0.8
Screenshot:

Gaupol is an editor for text-based subtitle files. It supports multiple subtitle file formats and provides means of correcting texts and timing subtitles to match video. The user interface is designed with attention to batch processing of multiple documents and convenience of translating.

Subtitle Editor 

 Interface: GTK+
 Website: http://kitone.free.fr/subtitleeditor/[]
Current version: 0.13.6 (stable), 0.20.0alpha4 (unstable)
Screenshot:

Subtitle Editor is a GTK+2 tool to edit subtitles for GNU/*. It can be used for new subtitles or as a tool to transform, edit, correct and refine existing subtitle. This program also shows sound waves, which makes it easier to synchronise subtitles to voices.

Gnome Subtitles 

 Interface: GTK+
 Website: http://gnome-subtitles.sourceforge.net/[]
Current version: 0.6

Gnome Subtitles is a subtitle editor for the GNOME desktop. It supports the most common text-based subtitle formats (like Advanced Sub Station Alpha, MicroDVD, MPlayer, MPlayer 2, MPSub, SubRip, Sub Station Alpha, SubViewer 1.0, SubViewer 2.0, etc) and allows for subtitle editing, translation and synchronization.

$ aptitude install gnome-subtitles
The following NEW packages will be installed:
  gnome-sharp2 gnome-sharp2-examples gnome-subtitles gtk-sharp2
  gtk-sharp2-examples gtk-sharp2-gapi libart2.0-cil libgail18
  libgconf2.0-cil libglade2.0-cil libglib2.0-cil libgnome-vfs2.0-cil
  libgnome2.0-cil libgtk2.0-cil libgtkhtml2.0-cil libgtkhtml3.8-15
  libmono-cairo1.0-cil libmono-corlib1.0-cil libmono-corlib2.0-cil
  libmono-data-tds2.0-cil libmono-security2.0-cil libmono-sharpzip2.84-cil
  libmono-system-data2.0-cil libmono-system-web2.0-cil
  libmono-system1.0-cil libmono-system2.0-cil libmono0 libmono2.0-cil
  librsvg2.0-cil libvte2.0-cil mono-common mono-gac mono-jit mono-runtime
  monodoc-gtk2.0-manual monodoc-manual
The following packages will be upgraded:
  libgail-common

GSubEdit 

 Interface: GTK
 Website: http://gsubedit.sourceforge.net/[]
Current version: 0.4

GSubEdit (aka GNOME Subtitle Editor) is a tool for editing and converting DivX ;-) subtitles. It currently features read/write of SubRip (.srt) and MicroDVD (.sub) subtitles. Framerate conversion and frame displacement (Increase/decrease all frames by a given offset) is also supported.

KSubtile 

 Interface: KDE
 Website: http://ksubtile.sourceforge.net/[]
Current version: 1.2

KSubtile is an editor for the KDE environment to edit, make and save subtitles in the SRT subtitle format.

Jubler 

 Interface: Java
 Website: http://www.jubler.org/[]
Current version: 3.2.0

Jubler is a tool to edit text-based subtitles. It can be used as an authoring software for new subtitles or as a tool to convert, transform, correct and refine existing subtitles. The most popular subtitle formats can be used. Preview of the subtitles in realtime or in design time, spell checking, translation mode and styles editing are some of the main features.

Filed under: /lists, /sound & video, /applications

documented on: 2007.07.30

Jubler, Subtitle GUI editing tools 

Basic Info 

Usage 

java -jar Jubler.jar

Source 

http://www.panayotis.com/jubler/

http://www.panayotis.com/jubler/download.html

http://sourceforge.net/projects/jubler

Description 

Jubler is a tool to edit text-based subtitles. It can be used an an authoring software for new subtitles or as a tool to convert, transform, correct and refine existing subtitles. The most popular subtitle formats can be used. Preview of the subtitles in realtime or in design time, spell checking, translation mode and styles editing are some of the main features.

It is open source under a liberal (GNU) public licence. It is written in Java 5.0 (a.k.a. Java 1.5.0 ) in order to be really multi-platform.

Features 

http://www.panayotis.com/jubler/features.html

General features 
Key editing features 

Version 3.0.0-rc4 

Dependencies 

Generic package 

documented on: 2006.05.22

cmd:subs, pm:Subtitles 

Info 

Subtitles - fix timing for subtitles in various text formats

Source 

http://cpan.uwinnipeg.ca/dist/Subtitles http://cpan.uwinnipeg.ca/htdocs/Subtitles/README.html http://cpan.uwinnipeg.ca/htdocs/Subtitles/Subtitles.html

http://search.cpan.org/~karasik/Subtitles-0.08/ http://www.karasik.eu.org/software/Subtitles.tar.gz http://cpan.uwinnipeg.ca/cpan/authors/id/K/KA/KARASIK/Subtitles-0.09.tar.gz

Description 

Movie files can be viewed with subtitles, which are currently very popular as text files. The command line tool 'subs' and its perl backend Subtitles.pm provide means for simple loading, re-timing, converting, and storing these subtitle files. Supported formats are .srt, .sub, .smi, and .idx. It can easily be extended.

Features 

The module supports .srt, .sub, .smi, and .idx subtitle formats.

Releases 

Version        0.07    Released        27 Jan 2005
Version        0.08    Released        17 Oct 2005
Version        0.09    Released        9 Mar 2007

USAGE 

Warning: -i is a great feature, but use it with certain caution.

If subtitles are shown too early ( 5 seconds):

subs -i -b 5 file.sub

If subtitles are for a movie in 25 fps, need to be for 24 ( actual for frame-based formats only ).

subs -i -a 24/25 file.sub

If subtitles start 1 second too early, but in 1 hour are late in 7 seconds:

subs -i -p 0 -1 -p 1:00:00 +7 file.sub

Join two parts with 15-second gap

subs -o joined.sub -j 15 part1.sub part2.sub

Split in two after 50 minutes and half a second ( makes basename.1.sub and basename.2.sub ).

subs -o basename.sub -s 50:00.5 toobig.sub

Remove closed caption-specific comments such as '[Sneezing]' or '[Music playing]'

subs -e 's/[\s-]*\[.*\]\s*\n*//gs' sub.sub

Installation 

To install this module type the following:

perl Makefile.PL make make test

make install

subconv 

http://linux.bydg.org/~yogin/

Subconv converts divx subtitles from one format to another (currently only from srt/tmplayer/mdvd/sub2 to tmplayer/srt). It can also adjust subtitles delay and split subtitles. Subconv requires Python 2.1.

# subconv matrix.txt -o tmp matrix_new.txt
Auto-detects subtitles format and converts them to tmplayer.
# subconv -i srt matrix.txt matrix_new.txt
Forces srt-subtitles input and converts it to tmp-subtitles.
# subconv -i srt -o tmp -a 1 matrix.txt matrix_new.txt
Same as above, adds 1 second delay to new subtitles.
# subconv -i srt -S 01:30:03 matrix.txt matrix_cd1.txt matrix_cd2.txt
Converts and splits srt-subtitles "matrix.txt" to two tmplayer-format
subtitles. Split position is 01:30:03.

Latest version is 0.2.2

documented on: 2005.04.12

New subtitle ripper 

Newsgroups:  gmane.comp.video.transcode.user
Date:        Sun, 20 Aug 2006 22:27:24 +0200

Recently, I discovered that the subtitles on DVDs are stored as images. I also figured, that those image subtitles cannot be attached to ogm or mkv files. So I read a few tutorials and happened to install the "media-video/subtitleripper". This program is designed to convert the image-subtitles to text-subtitles (srt format). It's using a program for (handwritten) text recognition, and requires alot of corrections.

Now to the interesting part. I decided to write my own application to do the job, and it worked out very good. Better than I expected. So I decided to release it. You can download it from sourceforge: http://sourceforge.net/projects/sub2text/ It is however the first time I release or even work on a public project.

Please have a look at what I did - and try it for yourselves. I need people testing it.

Christian.Wasserthal

New subtitle ripper 

> Could you shed more light onto it please? Ie.
>
> - What kind of OCR mechanism are you using? - I haven't tried it, but I
> see that you're using the Java Swing interface.
>   Does it require many user interaction? Any way to automate the
>   process?
> - Does your sub2text depend on some dictionary to do the auto
> correction? - Any error report for mis-spelled words, etc? - Would it
> work for other languages than English?

Thank you for replying to my mail : ).

  1. The mechanism I am using to recognize characters is the following: I look for connected areas (4-neighborhood) in the 2-color image. One or more areas form a 'shape' which lies in a small database and is associated with an unicode-letter. So a 'shape' is represented by a list of pixel positions relative to the seed point (the leftmost of the topmost pixels in the shape).

  2. When the database is empty, every letter found has to be fulfilled (that means that all areas that belong to it have to be selected) and the unicode representation has to be entered. Also user-interaction is needed to resolve ambiguous characters. (In a lot of DVD-fonts the uppercase i and the lowercase L look exactly the same). But the interface is very fast, you don't need to touch the mouse often. The arrowkeys and return do most of the job. (I just thought of using gocr for guessing the letter…)

  3. No. Also there is no 'auto'-detection (in the way of software- intuition). But aspell can be used to solve the ambiguousness's.

  4. No. Only words containing ambiguous characters are check in this way.

  5. It _should_ be ready for all unicode-eventualities.

I hope I can make a screenshot tutorial soon.

Christian.Wasserthal