Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Better detection for HFR (High Frame Rate) videos.
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Oct 29, 2020
1 parent f05bdba commit 9bdc6ef
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/WWW/StrawViewer/Itags.pm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ sub get_itags {
{value => 299, format => 'mp4', dash => 1, hfr => 1}, # mp4 HFR (v)
{value => 248, format => 'webm', dash => 1}, # webm (v)
{value => 137, format => 'mp4', dash => 1}, # mp4 (v)
{value => 399, format => 'av1', dash => 1}, # av1 (v)
{value => 399, format => 'av1', dash => 1, hfr => 1}, # av1 (v)
{value => 46, format => 'webm'}, # webm (v-a)
{value => 37, format => 'mp4'}, # mp4 (v-a)
{value => 301, format => 'mp4', live => 1}, # mp4 (live) (v-a)
Expand All @@ -73,7 +73,7 @@ sub get_itags {
{value => 298, format => 'mp4', dash => 1, hfr => 1}, # mp4 HFR (v)
{value => 247, format => 'webm', dash => 1}, # webm (v)
{value => 136, format => 'mp4', dash => 1}, # mp4 (v)
{value => 398, format => 'av1', dash => 1}, # av1 (v)
{value => 398, format => 'av1', dash => 1, hfr => 1}, # av1 (v)
{value => 45, format => 'webm'}, # webm (v-a)
{value => 22, format => 'mp4'}, # mp4 (v-a)
{value => 300, format => 'mp4', live => 1}, # mp4 (live) (v-a)
Expand Down Expand Up @@ -166,7 +166,9 @@ sub _find_streaming_url {

next if not exists $stream->{$itag->{value}};

if ($itag->{hfr}) {
my $entry = $stream->{$itag->{value}};

if (defined($entry->{fps}) and $entry->{fps} >= 50) {
$args{hfr} || next; # skip high frame rate (HFR) videos
}

Expand All @@ -175,6 +177,7 @@ sub _find_streaming_url {
}

if ($itag->{dash}) {

$args{dash} || next;

my $video_info = $stream->{$itag->{value}};
Expand All @@ -194,8 +197,6 @@ sub _find_streaming_url {
}
}

my $entry = $stream->{$itag->{value}};

# Ignore segmented DASH URLs (they load pretty slow in mpv)
if (not $args{dash_segmented}) {
next if ($entry->{url} =~ m{/api/manifest/dash/});
Expand Down

0 comments on commit 9bdc6ef

Please sign in to comment.