SRevie...actory(3pm)

πŸ“¦ version 0.8.0, in ubuntu jammy

πŸ’– SRevie...actory(3pm) πŸ’–

okay bestie, welcome to the User Contributed Perl Documentation corner of the internet, where we're talking about SReview::Video::ProfileFactory πŸŽ€


✨ NAME ✨

SReview::Video::ProfileFactory β€” bestie, it literally makes an output profile out of an input video. that's the whole job. slay. πŸ’…


🌸 SYNOPSIS 🌸

use SReview::Video;
use SReview::Videopipe;
use SReview::Video::ProfileFactory;

package SReview::Video::Profile::myprofile;
use Moose;
extends SReview::Video::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 = SReview::Video->new(url => "foo.mp4");
my $profile = SReview::Video::ProfileFactory->create("myprofile", $input);
my $output = SReview::Video->new(url => "foo." . $profile->exten, reference => $profile);
SReview::Videopipe->new(inputs => [$input], output => $output)->run();

like. look at her. iconic behavior fr fr πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

so "SReview::Video::Profile::Base" is a subclass of SReview::Video, except a bunch of the probing methods are overridden so they hand back values that are not in line with the reference of the video you gave it. lowkey unhinged, highkey intentional. 😌

and the create method on "SReview::Video::ProfileFactory" is just a lil helper that does two things, no cap:

  • makes sure the relevant "SReview::Video::Profile::profile" module has actually been loaded πŸ“¦
  • builds an "SReview::Video" subclass of the right type, with reference set to the input "SReview::Video" object you passed in 🫢

🧚 CREATING NEW PROFILES 🧚

you can make a whole new profile by extending one that already exists β€” the "myprofile" profile up in the synopsis is literally the blueprint, bestie, just copy the vibe. any property that SReview::Video knows about can be overridden the exact way shown there. periodt. πŸ’…

you could also make a new profile with the "extra_profiles" configuration setting, but heads up: profiles made that way can only hardcode values, and they cannot vary any parameters based on the input file. so if you want a profile that can do the variable thing, here's the tea:

  • if your new profile is just tweaking one minor detail of an existing profile β†’ extend that profile and change the detail you wanna change ✨
  • if you're building one from scratch β†’ extend the "Base" profile (details below) 🌈

πŸ‘‘ PRE-EXISTING PROFILES πŸ‘‘

these are the profiles that "SReview::Video::ProfileFactory" ships with, and they all ate:

πŸŽ€ Base

this one is the base class for all the other profiles. do NOT use it directly, she's a mother, not a main character. πŸ™ˆ

what she does: adds the extension, and defaults the pixel format to yuv420p.

πŸ”₯ vp9

spits out video in WebM/VP9 format, using the quality/bitrate settings Google recommends over at <https://developers.google.com/media/vp9/>, and with OPUS audio. files come out with the "vp9.webm" extension.

audio settings are hardcoded to 48KHz sampling rate, 128k bits per second. no negotiating. πŸ’€

🌸 vp8

spits out video in WebM/VP8 format. since there's no similar set of recommendations for VP8 like there is for VP9, this profile configures no explicit quality or bitrate settings. the libvpx video codec is selected, and libvorbis is picked for audio.

the audio bitrate is explicitly left to ffmpeg defaults; the extension is set to "vp8.webm".

πŸ¦‹ webm

this one subclasses from the "vp9" profile and only changes the extension to plain "webm" instead of "vp9.webm".

also, plot twist: if a future version of WebM ever gets defined, then once SReview gains support for that version of WebM, this class will become a subclass of that class instead. foreshadowing, iykyk. πŸ‘€

⭐ vp8_lq

this one subclasses from the "vp8" profile. extension gets set to "lq.webm". and on top of everything the "vp8" profile already does, this profile also rescales the video down to a fraction of the original β€” meaning the height and the width of the video are both divided by 8. tiny queen energy. πŸ“


🌈 SEE ALSO 🌈

SReview::Video


and that's the whole page bestie, you're welcome πŸ’– this gorgeous piece of documentation is from perl v5.32.1, dated 2021-09-09, and it lives under the SRevie...actory(3pm) header β€” go forth and build profiles, you've got this 🫢✨

πŸ“¦ where this page comes from