« blib/lib/Media/Convert/Asset/Profile/av1.pm
↑ Summary
blib/lib/Media/Convert/Normalizer/Bs1770gain.pm »
| 1 | package Media::Convert::KeyframeFinder; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use v5.28; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 3 | ▶ | use JSON::MaybeXS qw/decode_json/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 3 | ▶ | use autodie qw/:all/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 3 | has 'asset' => ( | |||||||||||||||||||
| 10 | is => 'ro', | ||||||||||||||||||||
| 11 | isa => 'Media::Convert::Asset', | ||||||||||||||||||||
| 12 | required => 1, | ||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 3 | has 'keyframes' => ( | |||||||||||||||||||
| 16 | is => 'ro', | ||||||||||||||||||||
| 17 | isa => 'ArrayRef[Num]', | ||||||||||||||||||||
| 18 | lazy => 1, | ||||||||||||||||||||
| 19 | builder => '_build_keyframes', | ||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 3 | ▶ | sub _build_keyframes { | ||||||||||||||||||
|
Subroutine
_build_keyframes: called CC=5 SCAR=27.4
| |||||||||||||||||||||
| 23 | 3 | my $self = shift; | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 3 | local $/ = ""; | |||||||||||||||||||
| 26 | 3 | my @pipe = ("ffprobe", "-loglevel", "quiet", "-print_format", "json", "-show_format", "-select_streams", "v", "-skip_frame", "nokey", "-show_frames", "-show_entries", "frame=pts_time,pict_type,best_effort_timestamp_time", $self->asset->url); | |||||||||||||||||||
| 27 | 3 | say "Running: '". join("' '", @pipe) . "'"; | |||||||||||||||||||
| 28 | 3 | open my $jsonpipe, "-|:encoding(UTF-8)", @pipe; | |||||||||||||||||||
| 29 | 0 | my $data = decode_json(<$jsonpipe>); | |||||||||||||||||||
| 30 | 0 | my $rv = []; | |||||||||||||||||||
| 31 | 0 | ▶ | my $offset = $data->{format}{start_time} // 0; | ||||||||||||||||||
|
Condition0%0/2
$data->{"format"}{"start_time"} // 0
MC/DC0%0/1
$data->{"format"}{"start_time"} // 0
$data->{"format"}{"start_time"}
Truth table0%0/2
A
A= $data->{"format"}{"start_time"}
| |||||||||||||||||||||
| 32 | 0 | foreach my $frame(@{$data->{frames}}) { | |||||||||||||||||||
| 33 | 0 | ▶ | next unless $frame->{pict_type} eq "I"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 34 | 0 | ▶ | push @$rv, ($frame->{pts_time} // $frame->{best_effort_timestamp_time}) - $offset; | ||||||||||||||||||
|
Condition0%0/3
$frame->{"pts_time"} // $frame->{"best_effort_timestamp_time"}
MC/DC0%0/2
$frame->{"pts_time"} // $frame->{"best_effort_timestamp_time"}
$frame->{"pts_time"}
$frame->{"best_effort_timestamp_time"}
Truth table0%0/3
A // B
A= $frame->{"pts_time"}B= $frame->{"best_effort_timestamp_time"}
| |||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | 0 | return $rv; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 3 | ▶ | no Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 3 | 1; | |||||||||||||||||||