From fac0f36d350a7d3793a13fe9d752596fbf2a693e Mon Sep 17 00:00:00 2001
From: Jason Dove <1695733+jasongdove@users.noreply.github.com>
Date: Tue, 30 Sep 2025 13:58:24 -0500
Subject: [PATCH] add codec info to multivariant playlist (#2472)
* add codec info to multivariant playlist
* upgrade dependencies
---
CHANGELOG.md | 1 +
.../ChannelStreamingSpecsViewModel.cs | 11 ++++++
ErsatzTV.Application/Channels/Mapper.cs | 10 ++++-
.../Queries/GetChannelResolutionAndBitrate.cs | 3 --
.../Queries/GetChannelStreamingSpecs.cs | 3 ++
....cs => GetChannelStreamingSpecsHandler.cs} | 12 +++---
.../Channels/ResolutionAndBitrateViewModel.cs | 3 --
.../ErsatzTV.Infrastructure.csproj | 2 +-
ErsatzTV/Controllers/IptvController.cs | 37 ++++++++++++++++---
ErsatzTV/ErsatzTV.csproj | 2 +-
10 files changed, 62 insertions(+), 22 deletions(-)
create mode 100644 ErsatzTV.Application/Channels/ChannelStreamingSpecsViewModel.cs
delete mode 100644 ErsatzTV.Application/Channels/Queries/GetChannelResolutionAndBitrate.cs
create mode 100644 ErsatzTV.Application/Channels/Queries/GetChannelStreamingSpecs.cs
rename ErsatzTV.Application/Channels/Queries/{GetChannelResolutionAndBitrateHandler.cs => GetChannelStreamingSpecsHandler.cs} (55%)
delete mode 100644 ErsatzTV.Application/Channels/ResolutionAndBitrateViewModel.cs
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 680b1bd0e..cdfce7c50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -89,6 +89,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- GIFs flagged to loop forever will loop forever
- GIFs with a specific loop count will loop the specified number of times and then hold the final frame
- Note that looping is relative to the start of the content, so this works best with permanent watermarks
+- Fix some more hls.js warnins by adding codec information to multi-variant playlists
### Changed
- Filler presets: use separate text fields for `hours`, `minutes` and `seconds` duration
diff --git a/ErsatzTV.Application/Channels/ChannelStreamingSpecsViewModel.cs b/ErsatzTV.Application/Channels/ChannelStreamingSpecsViewModel.cs
new file mode 100644
index 000000000..a6a46aa97
--- /dev/null
+++ b/ErsatzTV.Application/Channels/ChannelStreamingSpecsViewModel.cs
@@ -0,0 +1,11 @@
+using ErsatzTV.Core.Domain;
+
+namespace ErsatzTV.Application.Channels;
+
+public record ChannelStreamingSpecsViewModel(
+ int Height,
+ int Width,
+ int Bitrate,
+ FFmpegProfileVideoFormat VideoFormat,
+ string VideoProfile,
+ FFmpegProfileAudioFormat AudioFormat);
diff --git a/ErsatzTV.Application/Channels/Mapper.cs b/ErsatzTV.Application/Channels/Mapper.cs
index 4f702abf4..75f9256d7 100644
--- a/ErsatzTV.Application/Channels/Mapper.cs
+++ b/ErsatzTV.Application/Channels/Mapper.cs
@@ -49,8 +49,14 @@ internal static class Mapper
internal static ResolutionViewModel ProjectToViewModel(Resolution resolution) =>
new(resolution.Height, resolution.Width);
- internal static ResolutionAndBitrateViewModel ProjectToViewModel(Resolution resolution, int bitrate) =>
- new(resolution.Height, resolution.Width, bitrate);
+ internal static ChannelStreamingSpecsViewModel ProjectToSpecsViewModel(Channel channel) =>
+ new(
+ channel.FFmpegProfile.Resolution.Height,
+ channel.FFmpegProfile.Resolution.Width,
+ (int)((channel.FFmpegProfile.VideoBitrate * 1000 + channel.FFmpegProfile.AudioBitrate * 1000) * 1.2),
+ channel.FFmpegProfile.VideoFormat,
+ channel.FFmpegProfile.VideoProfile,
+ channel.FFmpegProfile.AudioFormat);
private static ArtworkContentTypeModel GetLogo(Channel channel)
{
diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelResolutionAndBitrate.cs b/ErsatzTV.Application/Channels/Queries/GetChannelResolutionAndBitrate.cs
deleted file mode 100644
index 2b7cd74f7..000000000
--- a/ErsatzTV.Application/Channels/Queries/GetChannelResolutionAndBitrate.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace ErsatzTV.Application.Channels;
-
-public record GetChannelResolutionAndBitrate(string ChannelNumber) : IRequest