Media:...::Pipe(3pm)
β¨ Media:...::Pipe(3pm) β the perl one, user contributed docs energy β¨
okay bestie so this is Media:...::Pipe(3pm), a page from the User Contributed Perl Documentation corner of the internet. it's giving "I do the actual work and nobody claps for me" and honestly? iconic. π
πΈ NAME πΈ
Media::Convert::Pipe β the class that generates ffmpeg command lines, working together with Media::Convert::Asset. π
π¦ SYNOPSIS π¦
use Media::Convert::Asset;
use Media::Convert::Pipe;
my $input_audio = Media::Convert::Asset->new(url => $input_filename_audio);
my $input_video = Media::Convert::Asset->new(url => $input_filename_video);
my $output = Media::Convert::Asset->new(url => $output_filename);
my $map_audio = Media::Convert::Map->new(input => $input_audio, type => "stream", choice => "audio");
my $map_video = Media::Convert::Map->new(input => $input_video, type => "stream", choice => "video");
my $pipe = Media::Convert::Pipe->new(inputs => [$input_audio, $input_video], map => [ $map_audio, $map_video ], output => $output);
$pipe->run();
# Or, if progress information is wanted:
sub print_progress {
my $percentage = shift;
print "Transcoding progress: $percentage\r";
}
$pipe->progress(\&print_progress);
$pipe->run();
no cap, that's the whole vibe right there. π«Ά
π DESCRIPTION π
Media::Convert::Pipe is that class inside the Media::Convert package β the one doing most of the hard work in Media::Convert. she generates the ffmpeg command line, she runs it, and she captures the output where it's needed. main character energy, fr fr. π
what she does, specifically: Media::Convert::Pipe compares the properties of the input Media::Convert::Asset objects against the properties of the output Media::Convert::Asset object, and then adds all the necessary parameters to the ffmpeg command line so the audio/video material in the input file gets converted to the format the output file is asking for. slay. β¨
π ATTRIBUTES π
these are the attributes that Media::Convert::Pipe supports, bestie:
π inputs
the objects to read from. must be Media::Convert::Asset objects. if you're passing more than one object, a value for the map attribute may be required, so ffmpeg knows which audio/video stream to read from which file. iykyk.
more input objects can be added using the add_input method, and they can all be removed using the clear_inputs object.
π§ output
the object to write to. must be a Media::Convert::Asset object. required, no skipping it.
if any properties differ between the input objects and the output object (like, the codec, the pixel format, the audio sample frequency, the video resolution, etc etc etc β the list literally goes on), Media::Convert::Pipe will add the necessary command-line options to the ffmpeg command line to convert the video from the input file to the output file. π«
π map
an array of Media::Convert::Map objects, used to manipulate which audio and video streams exactly get written to the output file (and in which order, etc).
for more info: see Media::Convert::Map.
maps can be cleared with clear_map, and added to with add_map. π
β vcopy
boolean. if true, explicitly tell Media::Convert to copy the video without transcoding it.
normally, Media::Convert should not request a transcode if every single attribute of the input file and the output file are exactly the same. but getting this right may sometimes be problematic, however. in those cases, it can be good to explicitly say that the video should not be transcoded. that's literally what this property is for. π
π acopy
the same as vcopy, but for audio instead of video. twin behavior, different lane. π§
πΈ vskip
tell Media::Convert that the output file should not contain any video (i.e. that it should skip handling of any video). this is implied if the output container doesn't support video streams (e.g. the .wav format), but it's required if it does. π
π¦ askip
the same as vskip, but for audio rather than video. βοΈ
π₯ multipass
boolean. if true, the run method performs a two-pass encode instead of a single-pass encode.
two-pass encodes may generate a better end result, but they require more time to perform. so like, trade-off, bestie. β³
π progress
normally, Media::Convert::Pipe shows (and runs) the ffmpeg command. any output of the ffmpeg command is shown on stdout.
if this attribute is set to a coderef, then here's what goes down:
- the ffmpeg command line that gets executed gains
-progress /dev/stdoutparameters - the output of the ffmpeg command is parsed, and the completion percentage is calculated (and all other output is suppressed)
- the coderef that was passed to this attribute is executed with the completion percentage as the only parameter, every time the percentage changes
obsessed with a progress bar, ngl. π
π METHODS π
π run
run the ffmpeg command.
β οΈ real talk: if this method is not run at least once, the object's destructor will issue a warning. so like, run it. don't leave her hanging. π
π POD ERRORS π
hey! the above document had some coding errors, which are explained below:
Around line 196:
=over should be: '=over' or '=over positive_number'
not the =over being shady π anyway, we move.
and that's the page, bestie. this one came to you from perl v5.40.1, dated 2026-02-15 β go forth and transcode responsibly, mwah ππβ¨
π¦ 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