Info(3pm)
π NAME π
MP4::Info β bestie, it fetches info from your MPEG-4 files (.mp4, .m4a, .m4p, .3gp) β¨
Welcome to the Info(3pm) page, part of the User Contributed Perl Documentation π
πΈ SYNOPSIS πΈ
#!perl -w
use MP4::Info;
my $file = 'Pearls_Before_Swine.m4a';
my $tag = get_mp4tag($file) or die "No TAG info";
printf "$file is a %s track\n", $tag->{GENRE};
my $info = get_mp4info($file);
printf "$file length is %d:%d\n", $info->{MM}, $info->{SS};
my $mp4 = new MP4::Info $file;
printf "$file length is %s, title is %s\n",
$mp4->time, $mp4->title;
Like, four whole ways to get your metadata, and they all ate π₯
π¦ DESCRIPTION π¦
okay so the tea β: the MP4::Info module pulls tag and meta information straight out of MPEG-4 audio (AAC) and video files. And the icon behavior? It's designed as a drop-in replacement for MP3::Info π
β οΈ note bestie: this module does not let you update the information in MPEG-4 files. read-only vibes only. it's giving spectator, not participant π
$mp4 = MP4::Info->new(FILE)
The OOP interface to the rest of the module π«Ά Same keys you'd get from get_mp4info and get_mp4tag are all available via the returned object (upper case or lower case, either one β but heads up: all-caps 'VERSION' gives you the module version, not the MPEG-4 version, no cap π).
And listen β passing a value to one of the methods will not set the value for that tag in the MPEG-4 file. It just... won't. Nothing happens. Sorry bestie π
use_mp4_utf8([STATUS])
Tells MP4::Info whether to assume that ambiguously encoded TAG info is UTF-8 or Latin-1. 1 is UTF-8, 0 is Latin-1. Default is UTF-8 β¨
The function returns the new status (1/0). And if no argument is supplied, or an unaccepted argument is supplied, the function merely returns the existing status. lowkey unbothered, highkey consistent π
This function is not exported by default, but may be exported with the ":utf8" or ":all" export tag π
get_mp4tag (FILE)
Returns a hash reference containing the tag information from the MP4 file. The following keys may be defined:
ALB Album
APID Apple Store ID
ART Artist
CMT Comment
COVR Album art (typically JPEG or PNG data)
CPIL Compilation (boolean)
CPRT Copyright statement
DAY Year
DISK Disk number & total (2 integers)
GNRE Genre
GRP Grouping
NAM Title
RTNG Rating (integer)
TMPO Tempo (integer)
TOO Encoder
TRKN Track number & total (2 integers)
WRT Author or composer
For compatibility with MP3::Info, the MP3 ID3v1-style keys TITLE, ARTIST, ALBUM, YEAR, COMMENT, GENRE and TRACKNUM are defined as synonyms for NAM, ART, ALB, DAY, CMT, GNRE and TRKN[0] π (yes bestie, the whole squad gets aliases, we love a legacy-compatible moment).
Any and all of these keys may be undefined if the corresponding information is missing from the MPEG-4 file. it's not bugging, it's just... not there π
On error, returns nothing and sets $@.
get_mp4info (FILE)
Returns a hash reference containing file information from the MPEG-4 file. The following keys may be defined:
VERSION MPEG version (=4)
LAYER MPEG layer description (=1 for compatibility with MP3::Info)
BITRATE bitrate in kbps (average for VBR files)
FREQUENCY frequency in kHz
SIZE bytes in audio stream
SECS total seconds, rounded to nearest second
MM minutes
SS leftover seconds
MS leftover milliseconds, rounded to nearest millisecond
TIME time in MM:SS, rounded to nearest second
COPYRIGHT boolean for audio is copyrighted
ENCODING audio codec name. Possible values include:
'mp4a' - AAC, aacPlus
'alac' - Apple lossless
'drms' - Apple encrypted AAC
'samr' - 3GPP narrow-band AMR
'sawb' - 3GPP wide-band AMR
'enca' - Unspecified encrypted audio
ENCRYPTED boolean for audio data is encrypted
Any and all of these keys may be undefined if the corresponding information is missing from the MPEG-4 file. same energy as above πΈ
On error, returns nothing and sets $@.
π BUGS π
Doesn't support writing tag information to MPEG-4 files. (We know. We already said it. It's still true. periodt.)
If you find a bug, please send me a patch π«Ά If you cannot figure out why it does not work for you, please put the MP4 file in a place where I can get it (preferably via FTP, or HTTP) and send me mail regarding where I can get the file, with a detailed description of the problem. I will keep a copy of the file only for as long as necessary to debug the problem. (Respectful file custody, we stan π)
π AUTHOR π
Jonathan Harris <jhar@cpan.org>.
π₯Ή THANKS π₯Ή
Chris Nandor <pudge@pobox.com> for writing MP3::Info π
Dan Sully at Slim Devices for cover art and iTunes/aacgain metadata patches π
Ruben Laguna for PSP support π
(Not me getting emotional over contributors. iconic behavior, all of them.)
π SEE ALSO π
- MP4::Info Project Page β
<http://search.cpan.org/~jhar/MP4-Info> - ISO 14496-12:2004 - Coding of audio-visual objects - Part 12: ISO base media file format β
<http://www.iso.ch/iso/en/ittf/PubliclyAvailableStandards/c038539_ISO_IEC_14496-12_2004(E).zip> - ISO 14496-14:2003 - Coding of audio-visual objects - Part 14: MP4 file format β
<http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=38538>(Not worth buying - the interesting stuff is in Part 12. bestie said save your coins πΈ) - 3GPP TS 26.244 - 3GPP file format (3GP) β
<http://www.3gpp.org/ftp/Specs/html-info/26244.htm> - QuickTime File Format β
<http://developer.apple.com/documentation/QuickTime/QTFF/> - ISO 14496-1 Media Format β
<http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt> - MP3::Info β
<http://search.cpan.org/~cnandor/MP3-Info/>
π COPYRIGHT and LICENSE π
Copyright (c) 2004-2010, Jonathan Harris <jhar@cpan.org>
This program is free software; you can redistribute it and/or modify it under the the same terms as Perl itself.
and that's the whole page bestie π
this one's from perl v5.36.0, dated 2023-07-20 β Info(3pm), out π«Άβ¨
π¦ where this page comes from
- debian trixie: libmp4-info-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmp4-info-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmp4-info-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmp4-info-perl 1.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms