Video::Info.3pm

Langue: en

Version: 2010-05-14 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Video::Info - Retrieve video properties such as:
 height
 width
 codec
 fps

SYNOPSIS

   use Video::Info;
 
   my $info = Video::Info->new(-file=>'my.mpg');
 
   $info->fps();
   $info->aspect();
   ## ... see methods below
 
 

DESCRIPTION

Video::Info is a factory class for working with video files. When you create a new Video::Info object (see methods), something like this will happen:
 1) open file, determine type. See Video::Info::Magic.
 2) attempt to create object of appropriate class
    (ie, MPEG::Info for MPEG files, RIFF::Info for AVI
    files).
 3) Probe the file for various attributes
 4) return the created object, or a Video::Info object
    if the appropriate class is unavailable.

Currently, Video::Info can create objects for the following filetypes:

   Module                 Filetype
   -------------------------------------------------
   Video::Info::ASF              ASF
   MP3::Info              MPEG Layer 2, MPEG Layer 3
   Video::Info::MPEG      MPEG1, MPEG2, MPEG 2.5
   Video::Info::RIFF      AVI, DivX
   Video::Info::Quicktime MOV, MOOV, MDAT, QT
 
 

And support is planned for:

   Module                 Filetype
   -------------------------------------------------
   Video::Info::Real      RealNetworks formats
 
 

METHODS

CONSTRUCTORS AND FRIENDS

new(): Constructor for a Video::Info object. new() is called with the following arguments:
   Argument    Default    Description
   ------------------------------------------------------------
   -file       none        path/to/file to create an object for
   -headersize 10240       how many bytes of -file should be
                           sysread() to determine attributes?
 
 

probe(): The core of each of the manufactured modules (with the exception of MP3::Info, which we manufacture only as courtesy), is in the probe() method. probe() does a (series of) sysread() to determine various attributes of the file. You don't need to call probe() yourself, it is done for you by the constructor, new().

METHODS

These methods should be available for all manufactured classes (except MP3::Info):

Audio Methods

achans()
Number of audio channels. 0 for no sound, 1 for mono,2 for stereo. A higher value is possible, in principle.
acodec()
Name of the audio codec.
arate()
bits/second dedicated to an audio stream.
astreams()
Number of audio streams. This is often >1 for files with multiple audio tracks (usually in different languages).
afrequency()
Sampling rate of the audio stream, in Hertz.

Video Methods

vcodec()
Name of the video codec.
vframes()
Number of video frames.
vrate()
average bits/second dedicated to a video stream.
vstreams()
Number of video streams. 0 for audio only. This may be >1 for multi-angle video and the like, but I haven't seen it yet.
fps()
How many frames/second are displayed.
width()
video frame width, in pixels.
height()
video frame height, in pixels.

Other Methods

filename()
path to the file used to create the video object
filesize()
size in bytes of filename()
type()
file type (RIFF, ASF, etc).
duration()
file length in seconds
minutes()
file length in minutes, rounded down
MMSS()
file length in minutes + seconds, in the format MM:SS
geometry()
Ben?
title()
Title of the file content. Not the filename.
author()
Author of the file content.
copyright()
Copyright, if any.
description()
Freetext description of the content.
rating()
This is for an MPAA rating (PG, G, etc).
packets()
Number of data packets in the file.

AUTHORS

  Copyright (c) 2002
  Aladdin Free Public License (see LICENSE for details)
  Allen Day, <allenday@ucla.edu>
  Benjamin R. Ginter <bginter@asicommunications.com>
 
 

SEE ALSO

Video::Info::Magic Video::Info::ASF Video::Info::MPEG Video::Info::Quicktime Video::Info::RIFF