From 572a3be33ed53188880dee49159d8e6973b3dd0a Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Mon, 28 Feb 2022 19:22:11 -0600 Subject: [PATCH] limit framerate normalization to 24fps and above (#662) --- CHANGELOG.md | 4 ++++ .../Queries/GetChannelFramerateHandler.cs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6af852a4..f0510fed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix watermark on scaled and/or padded video with NVIDIA acceleration - Fix playback of interlaced mpeg2video content with NVIDIA acceleration +### Changed +- Framerate normalization will never normalize framerate below 24fps + - Instead, content with a lower framerate will be normalized up to 24fps + ## [0.4.2-alpha] - 2022-02-26 ### Fixed - Add improved but experimental transcoder logic, which can be toggled on and off in `Settings` diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs b/ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs index 825868612..a68c52019 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelFramerateHandler.cs @@ -31,7 +31,7 @@ public class GetChannelFramerateHandler : IRequestHandler playouts = await dbContext.Playouts @@ -58,12 +58,23 @@ public class GetChannelFramerateHandler : IRequestHandler mv.RFrameRate) .ToList(); - var distinct = frameRates.Distinct().ToList(); if (distinct.Count > 1) { // TODO: something more intelligent than minimum framerate? int result = frameRates.Map(ParseFrameRate).Min(); + if (result < 24) + { + _logger.LogInformation( + "Normalizing frame rate for channel {ChannelNumber} from {Distinct} to {FrameRate} instead of min value {MinFrameRate}", + request.ChannelNumber, + distinct, + 24, + result); + + return 24; + } + _logger.LogInformation( "Normalizing frame rate for channel {ChannelNumber} from {Distinct} to {FrameRate}", request.ChannelNumber,