NAME

Video::Subtitle::SRT - manipulate SRT subtitle files

SYNOPSIS

use Video::Subtitle::SRT;

my $subtitle = Video::Subtitle::SRT->new (\&callback);
$subtitle->parse ($fh);

sub callback {
    my $data = shift;
    # $data->{number}
    # $data->{start_time}
    # $data->{end_time}
    # $data->{text}
}

DESCRIPTION

Video::Subtitle::SRT is a callback based parser to parse SubRip subtitle files (.SRT). See "adjust-srt" in bin how to use this module to create subtitle delay adjusting tools.

FUNCTIONS

srt_time_to_milliseconds

Convert an SRT time into a time in milliseconds.

milliseconds_to_srt_time

Convert a time in milliseconds into an SRT time.

make_subtitle

Given a subtitle {data => 'Words', start_time => srt_time, end_time => srt_time} make that into an SRT subtitle time.

add

$srt->add ($data);

Add the line to the subtitles.

write_file

$srt->write_file ();

Write the file of subtitles to STDOUT.

EXPORTS

Exports on request: "srt_time_to_milliseconds", "milliseconds_to_srt_time", "make_subtitle";

SEE ALSO

http://en.wikipedia.org/wiki/SubRip
http://www.opensubtitles.org/

AUTHOR

The module's creator is Tatsuhiko Miyagawa <miyagawa@bulknews.net>. The module is currently maintained by Ben Bullock <bkb@cpan.org>.

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.