NAME

FLV::Cut - Extract FLV segments into new files

LICENSE

See FLV::Info

SYNOPSIS

   use FLV::Cut;
   my $converter = FLV::Cut->new();
   $converter->add_output('first_ten_sec.flv', undef, 10_000);
   $converter->add_output('middle_ten_sec.flv', 20_000, 30_000);
   $converter->add_output('tail.flv', 40_000, undef);
   $converter->parse_flv('input.flv');
   $converter->save_all;

DESCRIPTION

Efficiently extracts segments of an FLV into separate files.

WARNING: this tool does not help you find keyframes! If you pick a cut time that is not on a keyframe, you will see unpleasant video artifacts in the resulting media. For many input FLVs, you can use the following to find the keyframe times:

   my $flv = FLV::File->new;
   $flv->parse;
   $flv->populate_meta; # optional
   my @times = @{ $flv->get_meta('keyframe')->{times} };

METHODS

$pkg->new()

Instantiate a converter.

$self->add_output($flv_filename, $in_milliseconds, $out_milliseconds)

Register an output file for a particular time slice. Either the in or out times can be undefined to imply the beginning or end of the FLV, respectively. You can set both to undef, but that's pretty pointless... If the in or out times are not represented in the input FLV, that's OK -- you may just end up with less data than you expected in the output files.

$self->parse_flv($flv_filename)
$self->parse_flv($flv_instance)

Open and parse the specified FLV file. Alternatively, you may pass an instantiated and parsed FLV::File object.

$self->save_all()

Serialize all of the extracted FLVs to file.

AUTHOR

See FLV::Info