Info::MPEG(3pm)
π Info::MPEG(3pm) β like, the whole vibe π
okay bestie, sit down, hydrate, because we're about to talk about the Info::MPEG(3pm) page from the User Contributed Perl Documentation. it's giving multimedia nerd and honestly? we're obsessed. π
β¨ NAME β¨
Video::Info::MPEG β a basic MPEG bitstream attribute parser. no cap, that's the whole job description. π
πΈ SYNOPSIS πΈ
here's the little taste test, exactly as written:
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)
(not me noticing astreams and friends don't have semicolons in the original β copy-paste it exactly as-is, bestie, i'm just the messenger π«Ά)
π¦ DESCRIPTION π¦
so the Moving Picture Experts Group (MPEG) is a working group whose whole thing is developing standards for the coded representation of digital audio and video. iconic of them.
MPEG audio and video clips are literally everywhere, but using Perl to programmatically collect information about these bitstreams? up until now that's been a kludge at best. π
this module parses the raw bitstreams and pulls information straight out of the packet headers. it supports Audio, Video, and System packets (that's multiplexed audio + video, iykyk), so it works on nearly every MPEG you encounter. main character module energy, fr fr. π
π METHODS π
Video::Info::MPEG is a derived class of Video::Info, which is a factory module "designed to meet your multimedia needs for many types of files". (their words, and honestly? valid.)
new( -file => FILE )β the constructor. it requires the-fileargument and hands you back aVideo::Info::MPEGobject. no file, no object, periodt.probe()β parses the bitstreams in theFILEyou gave the constructor. returns1on success, or0if theFILEcouldn't be parsed as a valid MPEG audio, video, or system stream. that's the whole vibe check right there. β¨
π INHERITED METHODS π
these methods come from Video::Info. heads up: Video::Info may have changed since this documentation was written, but they're listed here anyway, for convenience. π
type()β returns the type of file. this should always beMPEG.comments()β returns the contents of the userdata MPEG extension. this often contains info about the encoder software. detective work, slay.
π Audio Methods π
astreams()β returns the number of audio bitstreams in the file. usually0or1.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. usually0or1.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.MPEG1orMPEG2).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, bestie. π
there are some MPEG-specific attributes that don't yet fit nicely into Video::Info. they're documented here for the sake of completeness.
β οΈ real talk: 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 they wanted to get this out there. you've been warned. π
these apply to audio bitstreams:
versionβ the MPEG version. e.g.1,2, or2.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 it's different thancopyright(). sneaky little bit. π
these apply to video:
aspectβ the aspect ratio, if the ratio falls into one of the defined standards. otherwise, it'sReserved.
Forbidden
1/1 (VGA)
4/3 (TV)
16/9 (Large TV)
2.21/1 (Cinema)
Reserved
π AUTHORS π
Benjamin R. Ginter, <bginter@asicommunications.com> β Allen Day, <allenday@ucla.edu>
π COPYRIGHT π
Copyright (c) 2001-2002
Aladdin Free Public License (see LICENSE for details)
Benjamin R. Ginter <bginter@asicommunications.com>, Allen Day <allenday@ucla.edu>
π₯ SEE ALSO π₯
Video::Info Β· Video::Info::RIFF Β· Video::Info::ASF
and that's the whole page, bestie!! π«Ά this was perl v5.36.0, dated 2022-12-12, and you just read Info::MPEG(3pm) in full. go parse some bitstreams, you absolute icon. π¦β¨π
π¦ where this page comes from
- debian bookworm: libvideo-info-perl 0.993-5 Β· AFPL
- debian trixie: libvideo-info-perl 0.993-5 Β· AFPL
- ubuntu noble: libvideo-info-perl 0.993-5 Β· AFPL
- ubuntu resolute: libvideo-info-perl 0.993-5 Β· AFPL
- ubuntu stonking: libvideo-info-perl 0.993-5 Β· AFPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms