Video::Info::MPEG(3) Basic MPEG bitstream attribute parser.

SYNOPSIS


use strict;
use Video::Info::MPEG;
my $video = Video::Info::MPEG->new( -file => $filename );
$video->probe();
print $file->type; ## MPEG
## Audio information
print $file->acodec; ## MPEG Layer 1/2
print $file->acodecraw; ## 80
print $file->achans; ## 1
print $file->arate; ## 128000 (bits/sec)
print $file->astreams ## 1
## Video information
printf "%0.2f", $file->fps ## 29.97
print $file->height ## 240
print $file->width ## 352
print $file->vstreams ## 1
print $file->vcodec ## MPEG1
print $file->vframes ## 529
print $file->vrate ## 1000000 (bits/sec)

DESCRIPTION

The Moving Picture Experts Group (MPEG) is a working group in charge of the development of standards for coded representation of digital audio and video.

MPEG audio and video clips are ubiquitous but using Perl to programmatically collect information about these bitstreams has to date been a kludge at best.

This module parses the raw bitstreams and extracts information from the packet headers. It supports Audio, Video, and System (multiplexed audio and video) packets so it can be used on nearly every MPEG you encounter.

METHODS

Video::Info::MPEG is a derived class of Video::Info, a factory module "designed to meet your multimedia needs for many types of files".
new( -file => FILE )
Constructor. Requires the -file argument and returns an Video::Info::MPEG object.
probe()
Parses the bitstreams in the FILE provided to the constructor. Returns 1 on success or 0 if the FILE could not be parsed as a valid MPEG audio, video, or system stream.

INHERITED METHODS

These methods are inherited from Video::Info. While Video::Info may have changed since this documentation was written, they are provided here for convenience.
type()
Returns the type of file. This should always be MPEG.
comments()
Returns the contents of the userdata MPEG extension. This often contains information about the encoder software.

Audio Methods

astreams()
Returns the number of audio bitstreams in the file. Usually 0 or 1.
acodec()
Returns the audio codec
acodecraw()
Returns the hexadecimal audio codec.
achans()
Returns the number of audio channels.
arate()
Returns the audio rate in bits per second.

Video Methods

vstreams()
Returns the number of video bitstreams in the file. Usually 0 or 1.
fps()
Returns the floating point number of frames per second.
height()
Returns the number of vertical pixels (the video height).
width()
Returns the number of horizontal pixels (the video width).
vcodec()
Returns the video codec (e.g. MPEG1 or MPEG2).
vframes()
Returns the number of video frames.
vrate()
Returns the video bitrate in bits per second.

EVIL DIRECT ACCESS TO CLASS DATA

So you secretly desire to be the evil Spock, eh? Well rub your goatee and read on.

There are some MPEG-specific attributes that don't yet fit nicely into Video::Info. I am documenting them here for the sake of completeness.

Note that if you use these, you may have to make changes when new versions of this package are released. There will be elegant ways to access them in the future but we wanted to get this out there.

These apply to audio bitstreams:

version
The MPEG version. e.g. 1, 2, or 2.5
layer
The MPEG layer. e.g. 1, 2, 3.
mode
The audio mode. This is one of:

  Mono
  Stereo
  Dual Channel
  Intensity stereo on bands 4-31/32
  Intensity stereo on bands 8-31/32
  Intensity stereo on bands 12-31/32
  Intensity stereo on bands 16-31/32
  Intensity stereo off, M/S stereo off
  Intensity stereo on, M/S stereo off
  Intensity stereo off, M/S stereo on
  Intensity stereo on, M/S stereo on
emphasis
The audio emphasis, if any.

  No Emphasis
  50/15us
  Unknown
  CCITT J 17
  Undefined
sampling
The sampling rate (e.g. 22050, 44100, etc.)
protect
The value of the protection bit. This is used to indicate copying is prohibited but is different than copyright().

These apply to video:

aspect
The aspect ratio if the ratio falls into one of the defined standards. Otherwise, it's Reserved.

  Forbidden
  1/1 (VGA)
  4/3 (TV)
  16/9 (Large TV)
  2.21/1 (Cinema)
  Reserved

AUTHORS

Benjamin R. Ginter, <[email protected]> Allen Day, <[email protected]>

COPYRIGHT

 Copyright (c) 2001-2002
 Aladdin Free Public License (see LICENSE for details)
 Benjamin R. Ginter <[email protected]>, Allen Day <[email protected]>