blib/lib/Media/Convert/Asset/Profile/av1.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 61 CC 5 SCAR 23.3
CC
5
Cov
0%
_probe_videocodec
30.0
_probe_exten
2.0
_probe_pix_fmt
2.0
CRAP 10.2
1 use Media::Convert::Asset::ProfileFactory;
2 package Media::Convert::Asset::Profile::av1;
3  
4 use Moose;
5  
6 extends 'Media::Convert::Asset::Profile::Base';
7  
8 use Media::Convert::FfmpegInfo;
9  
10 =head1 NAME
11  
12 Media::Convert::Asset::Profile::av1 - Create an av1/vorbis video
13  
14 =head1 SYNOPSIS
15  
16 use Media::Convert::Asset;
17 use Media::Convert::Asset::ProfileFactory
18 use Media::Convert::Pipe;
19  
20 my $input = Media::Convert::Asset->new(url => $input_filename);
21 my $profile = Media::Convert::Asset::ProfileFactory->create("av1", $input);
22 my $output = Media::Convert::Asset->new(url => "$output_basename." . $profile->exten, reference => $profile);
23 Media::Convert::Pipe->new(inputs => [$input], output => $output)->run();
24  
25 =head1 DESCRIPTION
26  
27 The C<av1> profile re-encodes the input video into AV1 with Vorbis audio.
28  
29 =cut
30  
31 sub _probe_exten {
32 return 'av1.webm';
33 }
34  
35 sub _probe_videocodec {
36 my $codecs = Media::Convert::FfmpegInfo->instance->codecs;
37 die "av1 not supported by ffmpeg" unless exists($codecs->{av1});
38 if($codecs->{av1}{description} =~ /libsvtav1/) {
39 my $version = Media::Convert::FfmpegInfo->instance->version;
40 die "svtav1 support immature by supplied version of ffmpeg" unless $version >= "5.1.0";
41 return "libsvtav1";
42 } elsif ($codecs->{av1}{description} =~ /libaom/) {
43 print STDERR "Warning: libsvtav1 not supported by ffmpeg. Trying libaom-av1 instead, which will probably be too slow...\n";
44 return "libaom-av1";
45 } else {
46 print STDERR "Warning: ffmpeg supports av1, but it is neither libsvtav1 nor libaom-av1. Trying, but not sure what's going to happen...\n";
47 return "av1";
48 }
49 }
50  
51 sub _probe_pix_fmt {
52 return "yuv420p10le";
53 }
54  
55 sub _probe_audiocodec {
56 return "vorbis";
57 }
58  
59 sub _probe_quality {
60 return 25;
61 }
62  
63 sub _probe_video_preset {
64 return 4;
65 }
66  
67 sub _probe_videobitrate {
68 return;
69 }
70  
71 sub _probe_videominrate {
72 return;
73 }
74  
75 sub _probe_videomaxrate {
76 return;
77 }
78  
79 sub _probe_extra_params {
80 return { "svtav1-params" => "tune=0:film-grain=8" };
81 }
82  
83 1;