Video-Info-Quicktime_PL

 view release on metacpan or  search on metacpan

Quicktime_PL.pm  view on Meta::CPAN

    $h{'Preview_time'}       = unpack( "Na4", substr($cntnt,0,4,''));  
    $h{'Preview_duration'}   = unpack( "Na4", substr($cntnt,0,4,''));  
    $h{'Poster_time'}        = unpack( "Na4", substr($cntnt,0,4,''));  
    $h{'Selection_time'}     = unpack( "Na4", substr($cntnt,0,4,''));  
    $h{'Selection_duration'} = unpack( "Na4", substr($cntnt,0,4,''));  
    $h{'Current_time'}       = unpack( "Na4", substr($cntnt,0,4,''));  
    $h{'Next_track_ID'}      = unpack( "Na4", substr($cntnt,0,4,''));  
    # print map {" $_ => $h{$_}\n"} sort keys %h;
    %h;
}

sub get_track_head {
    my ($track) = @_;
    
    my (%tkhd);
    
    $tkhd{'Version'} = hex( unpack("H*",substr($track,0,1 ,'') ));
    $tkhd{'Flags'} = unpack( "Na4", substr($track,0,3,'') );
    $tkhd{'Creation time'} = unpack( "Na4", substr($track,0,4 ,''));
    $tkhd{'Modification time'} = unpack( "Na4", substr($track,0,4 ,''));
    $tkhd{'Track ID'} = unpack( "Na4", substr($track,0,4 ,''));
    $tkhd{'Reserved'} = unpack( "Na4", substr($track,0,4 ,''));
    $tkhd{'Duration'} = unpack( "Na4", substr($track,0,4 ,''));
    $tkhd{'Reserved'}  = unpack( "Na8", substr($track,0,8 ,''));
    $tkhd{'Layer'} = unpack( "Na2", substr($track,0,2 ,''));
    $tkhd{'Alternate group'} = unpack( "Na2", substr($track,0,2 ,''));
    $tkhd{'Volume'}= unpack( "Na2", substr($track,0,2 ,''));
    $tkhd{'Reserved'}= unpack( "Na2", substr($track,0,2 ,''));
    $tkhd{'Matrix structure'}= unpack( "H36", substr($track,0,36,''));
    $tkhd{'Track width'}  = hex unpack( "H4", substr($track,0,4,'') );
    $tkhd{'Track height'} = hex unpack( "H4", substr($track,0,4,'') );
    
    # print map {" $_ => $tkhd{$_}\n"} sort keys %tkhd;
    %tkhd;
}

1;

=head1 NAME
    
Video::Info::Quicktime_PL - pure Perl implementation to extract header info from Quicktime (TM) files.
    
=head1 SYNOPSIS
    
    use Video::Info::Quicktime;

    my $file = Video::Info::Quicktime_PL->new(-file=>'eg/rot_button.mov');
    $file->probe;
    printf("frame size: %d x %d\n", $file->width, $file->height );
    printf("fps: %d, total length: %d (sec)\n", $file->fps, $file->duration );


    ## some digital cameras which are able to record Quicktime videos
    ## include a preview picture:

    if (length($file->pict)>0) {
        print "Outputing PICT file\n";
        my $oi = 'eg/mov_preview.pict';
        open(O,">$oi") || warn("Couldn't open $oi: $!\n");
        binmode(O);  # set the file to binary mode in working on Windows
        # Image::Magick methods will only recognize this file as 
        # PICT if there exists a leading header of zeros:
        print O "\x00" x 512;
        print O $file->pict;
        close(O);
    }


=head1 DESCRIPTION

This module provides cursory access to the header information of
Quicktime Movie files.  The original motivation for the development of
this module was to aid in thumbnail generation for HTML index files.
Thus, only a limited amount of information is returned.  See the test
files for a complete list.

If the Video::OpenQuicktime package is installed, you may consider
using Video::Info::Quicktime instead of this module.  Based on the
OpenQuicktime library, more complete header information is available
but at the cost of increased module and library dependancy.


=head1 AUTHOR

Copyright (c) 2003
Released under the Aladdin Free Public License (see LICENSE for details)

Pure Perl Implementation by W. Scott Hoge <shoge at perl dot org>
Hooks for Video::Info access by Allen Day <allenday at ucla dot edu>

=head1 SEE ALSO

L<perl>
L<Video::Info>
L<Video::OpenQuicktime>

=cut

__END__



( run in 0.729 second using v1.01-cache-2.11-cpan-39bf76dae61 )