The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Video::Pattern - Video class for frame generation.

SYNOPSIS

 use Video::Pattern;

 my $pattern = Video::Pattern->new(%parameters);
 $pattern->create($output_dir);

METHODS

new(%parameters)
 Constructor
  • delay_generator

     Delay generator object.
     Default value is Video::Delay::Const with 1_000 milisecond constant.
  • duration

     Video duration.
     Possible suffixes are:
     - ms for milisendons.
     - s for seconds.
     - min for minute.
     - h for hour.
     Default value is 10000 miliseconds.
  • fps

     Frames per second.
     Default value is 60.
  • image_generator

     Image generator object.
     Default value is Image::Random object with 1920 width, 1080
     height, image type 'image_type and random colors.
  • image_type

     Image type.
     Default value is 'bmp' which isn't defined user 'image_generator'.
create($output_dir)
 Create images to output directory.
 Returns undef.

ERRORS

 new():
         Parameter 'duration' must be numeric value or numeric value with time suffix.
         Parameter 'fps' must be numeric value.
         From Class::Utils::set_params():
                 Unknown parameter '%s'.

EXAMPLE

 use strict;
 use warnings;

 use File::Temp qw(tempdir);
 use File::Path qw(rmtree);
 use Video::Pattern;

 # Object.
 my $obj = Video::Pattern->new(
        'duration' => 10000,
        'fps' => 2,
 );

 # Temporary directory.
 my $temp_dir = tempdir();

 # Create frames.
 $obj->create($temp_dir);

 # List and print files in temporary directory.
 system "ls -l $temp_dir";

 # Remove temporary directory.
 rmtree $temp_dir;

 # Output on system supporting links like:
 # celkem 66968
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 000.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 001.bmp -> 000.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 002.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 003.bmp -> 002.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 004.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 005.bmp -> 004.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 006.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 007.bmp -> 006.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 008.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 009.bmp -> 008.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 010.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 011.bmp -> 010.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 012.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 013.bmp -> 012.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 014.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 015.bmp -> 014.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 016.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 017.bmp -> 016.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 018.bmp
 # lrwxrwxrwx 1 foobar foobar       7 20. čen 12.09 019.bmp -> 018.bmp
 # -rw-r--r-- 1 foobar foobar 6220854 20. čen 12.09 020.bmp

DEPENDENCIES

Class::Utils, English, File::Basename, File::Spec::Functions, Image::Random, Readonly, Video::Delay::Const.

On Windows File::Copy or Win32::Symlink.

SEE ALSO

Video::Delay::Array

Video::Delay class for predefined list of delays.

Video::Delay::Const

Video::Delay class for constant delay.

Video::Delay::Func

Video::Delay class for delays defined by math function.

REPOSITORY

https://github.com/michal-josef-spacek/Video-Pattern

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

 © 2012-2020 Michal Josef Špaček
 BSD 2-Clause License

VERSION

0.09