Info(3pm)
π NAME π
Video::Info β bestie, this is the module that goes and retrieves video properties for you. And when I say properties, I mean:
heightwidthcodecfps
Like, the whole vibe of a video file, extracted and handed to you. It's the Info(3pm) page, obviously, from the User Contributed Perl Documentation corner of the world, and it's giving extremely useful. π
β¨ SYNOPSIS β¨
Okay so this is literally all you have to do, no cap:
use Video::Info;
my $info = Video::Info->new(-file=>'my.mpg');
$info->fps();
$info->aspect();
## ... see methods below
Look at that. Clean. Iconic. aspect() is right there in the example, bestie, I'm just saying. π
π¦ DESCRIPTION π¦
So Video::Info is a factory class for working with video files. Fancy way of saying: you ask for a video, it hands you the right little object to deal with that video. When you create a new Video::Info object (peep the methods section, babes), here's the whole glow-up sequence that goes down:
- open file, determine type. See
Video::Info::Magic. - attempt to create object of appropriate class (ie,
MPEG::Infofor MPEG files,RIFF::Infofor AVI files). - Probe the file for various attributes
- return the created object, or a
Video::Infoobject if the appropriate class is unavailable.
not step 4 being the "well, we tried" fallback π the object still comes home with you though, so it's fine
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
Manifesting Video::Info::Real for her fr fr π―οΈβ¨
π 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?
So you must pass -file, there's no default, none, zero, nada β and -headersize defaults to 10240 bytes getting sysread()-ed to figure out the attributes. That's the whole table, bestie. π«Ά
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().
not you needing to do anything, the constructor handles it π the way new() is out here doing the labor so you don't have to
β METHODS β
These methods should be available for all manufactured classes (except MP3::Info):
π§ Audio Methods π§
achans()β Number of audio channels.0for no sound,1for mono,2for 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>1for 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.0for audio only. This may be>1for 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 objectfilesize()β size in bytes offilename()type()β file type (RIFF,ASF, etc).duration()β file length in secondsminutes()β file length in minutes, rounded downMMSS()β file length in minutes + seconds, in the formatMM:SSgeometry()β 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.
"Ben?" is doing so much heavy lifting here and honestly? relatable. geometry() stays mysterious, that's her main character energy π
π AUTHORS π
Copyright (c) 2002
Aladdin Free Public License (see LICENSE for details)
Allen Day, <allenday@ucla.edu>
Benjamin R. Ginter <bginter@asicommunications.com>
Shoutout to Allen and Benjamin for real, absolute legends, and also to the Aladdin Free Public License, which has its own whole LICENSE file with the details, go read it. π
π₯ SEE ALSO π₯
Video::Info::MagicVideo::Info::ASFVideo::Info::MPEGVideo::Info::QuicktimeVideo::Info::RIFF
okay that's the whole page bestie, you ate that π This was perl v5.36.0, dated 2022-12-12, filed under Info(3pm) β bye babes, go probe some videos! πΈβ¨π¦
π¦ 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