Info(3pm)

πŸ“¦
version 0.993 Β· 2 versions
  • 0.993 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.993 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Video::Info β€” bestie, this is the module that goes and retrieves video properties for you. And when I say properties, I mean:

  • height
  • width
  • codec
  • fps

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:

  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.
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. 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.
"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::Magic
  • Video::Info::ASF
  • Video::Info::MPEG
  • Video::Info::Quicktime
  • Video::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