Media:...Factory(3pm)
π Media:...Factory(3pm) β bestie's guide to Media::Convert::Asset::ProfileFactory π
okay so welcome to the User Contributed Perl Documentation page for Media::Convert::Asset::ProfileFactory, aka the manual page Media:...Factory(3pm). pull up a chair, we're making output profiles π
β¨ NAME β¨
Media::Convert::Asset::ProfileFactory β Create an output profile from an input video. that's it, that's the whole vibe. it takes your input video and spins you up a profile. iconic π¦
πΈ SYNOPSIS πΈ
like, here's the whole thing in action, no notes:
use Media::Convert::Asset;
use Media::Convert::Pipe;
use Media::Convert::Asset::ProfileFactory;
package Media::Convert::Asset::Profile::myprofile;
use Moose;
extends Media::Convert::Asset::Profile::webm;
has '+audio_samplerate' => (
builder => '_probe_my_audiorate',
);
has '+audio_codec' => (
default => 'vorbis',
);
sub _probe_exten {
return 'my.webm',
}
sub _probe_my_audiorate {
my $self = shift;
return $self->reference->audio_samplerate / 2;
}
no Moose;
package main;
my $input = Media::Convert::Asset->new(url => "foo.mp4");
my $profile = Media::Convert::Asset::ProfileFactory->create("myprofile", $input);
my $output = Media::Convert::Asset->new(url => "foo." . $profile->exten, reference => $profile);
Media::Convert::Pipe->new(inputs => [$input], output => $output)->run();
# Or using an ad-hoc profile:
$profile = Media::Convert::Asset::ProfileFactory->create("extraprofile", $input,
{
extraprofile => {
parent => "webm",
settings => { audio_codec => "vorbis", quality => 10 },
}
});
# After this, using the profile happens exactly the same way.
no cap, that last comment is literally the tea β once the profile exists, you use it the exact same way. periodt π
π DESCRIPTION π
so Media::Convert::Asset::Profile::Base is a subclass of Media::Convert::Asset, right? but plot twist: a bunch of the probing methods are overridden so they return values that are not in line with the reference of the given video. it's giving "main character who lies about their stats" but, like, on purpose π
and the create method of Media::Convert::Asset::ProfileFactory is just a lil helper that does three things:
- ensures the relevant
Media::Convert::Asset::Profile::profilemodule has actually been loaded (that's the module for theparentattribute of the ad-hoc profile, if you picked one) π«Ά - creates a
Media::Convert::Assetsubclass of the right type, withreferenceset to the inputMedia::Convert::Assetobject you passed in β¨ - if you went the ad-hoc route, it makes sure the relevant attributes on the resulting object get set to the values in the
settingskey of the ad-hoc profile's settings π
π¦ CREATING NEW PROFILES π¦
you can make a whole new profile by extending an existing one. the myprofile profile up in the example above is the demo of exactly how. any property that Media::Convert::Asset knows about can be overridden this way. slay.
<b>or</b>, you can create new profiles in the ad-hoc manner. it's easier, because it only needs an extra parameter passed to the create function. but β and this is the important part β profiles made this way can only hardcode values, and can't vary any parameters based on the input file. π
so if you want a profile that can vary stuff based on the input, and the new profile just changes a minor detail of an existing profile: extend that profile and change the detail you wanna change. and if you want a brand-new profile from scratch: extend the Base profile (see below). π
π PRE-EXISTING PROFILES π
these are all defined by Media::Convert::Asset::ProfileFactory, and they're just sitting there waiting for you:
π Base
this one is the base class for the other profiles. do not use it directly. i'm serious, bestie.
it adds the extension, and defaults the pixel format to yuv420p. cute.
π vp9
produces a video in WebM/VP9 format, using the quality/bitrate settings that Google recommends on https://developers.google.com/media/vp9/, and with OPUS audio. produces files with the vp9.webm extension. π
audio settings are hardcoded to 48KHz sampling rate, 128k bits per second. no vibes-based tuning here, it's just set.
π vp8
produces a video in WebM/VP8 format. since no similar recommendations for VP8 exist the way they do for VP9, no explicit quality or bitrate settings are configured in this profile. the libvpx video codec is selected, and libvorbis for audio.
the audio bitrate is explicitly left to ffmpeg defaults; the extension is set to vp8.webm. leaving it up to ffmpeg, we love a hands-off queen π
π webm
this profile subclasses from the vp9 profile, and only changes the extension to plain webm instead of vp9.webm. that's the whole glow-up. β¨
note that future versions of this class may switch to subclassing from the AV1 profile rather than the VP9 profile, although this will not happen before AV1 encoding can be done at reasonable speeds by Media::Convert. so like, heads up, but also not yet. π«Ά
π vp8_lq
this profile subclasses from the vp8 profile. the extension is set to lq.webm. on top of the changes the vp8 profile already made, this profile also rescales the video to a fraction of the original; that is, the height and width of the video are both divided by 4. small. smol. adorable. π
π« SEE ALSO π«
go read these next, bestie, they're all part of the lore:
Media::Convert::AssetMedia::Convert::Profile::mp4Media::Convert::Profile::mpeg2Media::Convert::Profile::copy
and that's the whole page, mwah π this was perl v5.40.1, dated 2026-02-15 β thanks for reading my lil manual-page essay, love u, bye π§π
π¦ where this page comes from
- ubuntu resolute: libmedia-convert-perl 1.5.2-1
- ubuntu stonking: libmedia-convert-perl 1.5.2-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms