Provided by: libmedia-convert-perl_1.1.0-2_all bug

NAME

       Media::Convert::Asset::ProfileFactory - Create an output profile from an input video.

SYNOPSIS

           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.

DESCRIPTION

       "Media::Convert::Asset::Profile::Base" is a subclass of Media::Convert::Asset, but with a number of the
       probing methods overridden so that they return values that are not in line with the reference of the
       given video.

       The "Media::Convert::Asset::ProfileFactory"'s "create" method is a simple helper to:

       •   ensure that the relevant "Media::Convert::Asset::Profile::profile" module has been loaded (the module
           for the "parent" attribute of the ad-hoc profile, if one is chosen)

       •   create  a  Media::Convert::Asset  subclass  of the right type, with reference set to the passed input
           "Media::Convert::Asset" object.

       •   if an ad-hoc profile was selected, ensure that the relevant attributes of the  resulting  object  are
           set to the values in the "settings" key of the ad-hoc profile's settings

CREATING NEW PROFILES

       It is possible to create a new profile by extending an existing one. The "myprofile" profile in the above
       example  demonstrates how to do so. Any property that is known by Media::Convert::Asset can be overridden
       in the manner given.

       Alternatively, one can create new profiles in the ad-hoc manner. This is easier, since it  only  requires
       an  extra parameter be passed to the "create" function; however, profiles created in this manner can only
       hardcode values, and cannot vary any parameters based on the input file.  To create a profile that can do
       so, when the new profile just changes a minor detail of an existing  profile,  extend  that  profile  and
       change  the  detail  which  you  want  to change. To create a new profile from scratch, extend the "Base"
       profile (see below).

PRE-EXISTING PROFILES

       The following profiles are defined by "Media::Convert::Asset::ProfileFactory":

   Base
       This profile serves as a base class for the other profiles. It should not be used directly.

       It adds the extension, and defaults the pixel format to yuv420p.

   vp9
       Produces a video in WebM/VP9  format,  using  the  quality/bitrate  settings  recommended  by  Google  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.

   vp8
       Produces a video in WebM/VP8 format. Since no similar recommendations for VP8 exist as  do  for  VP9,  no
       explicit  quality or bitrate settings are configured in this profile. The libvpx video codec is selected,
       and the libvorbis one for audio.

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

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

       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.

   vp8_lq
       This profile subclasses from the "vp8" profile. The extension is set to "lq.webm".  In  addition  to  the
       changes  made  by  the "vp8" profile, 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.

SEE ALSO

       Media::Convert::Asset,           Media::Convert::Profile::mp4,            Media::Convert::Profile::mpeg2,
       Media::Convert::Profile::copy

perl v5.36.0                                       2023-09-15              Media::Convert...:ProfileFactory(3pm)