Browse Source

lower gop size and keyframe interval

pull/2832/head
Jason Dove 5 months ago
parent
commit
29a75645a3
No known key found for this signature in database
  1. 1
      CHANGELOG.md
  2. 4
      ErsatzTV.FFmpeg/OutputFormat/OutputFormatConcatHls.cs
  3. 7
      ErsatzTV.FFmpeg/OutputFormat/OutputFormatHls.cs
  4. 9
      ErsatzTV/Pages/FFmpegEditor.razor

1
CHANGELOG.md

@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Move dark/light mode toggle to **Settings** > **UI** - Move dark/light mode toggle to **Settings** > **UI**
- Use latest (non-deprecated) authorization method with Jellyfin API - Use latest (non-deprecated) authorization method with Jellyfin API
- Replace direct Discord links with new contact page https://ersatztv.org/contact which also includes other options like Matrix - Replace direct Discord links with new contact page https://ersatztv.org/contact which also includes other options like Matrix
- Lower GOP size and keyframe interval from four seconds to two seconds in accordance with HLS2 draft spec recommendations
### Fixed ### Fixed
- Improve stability of playback orders `Shuffle` and `Shuffle in Order` over time - Improve stability of playback orders `Shuffle` and `Shuffle in Order` over time

4
ErsatzTV.FFmpeg/OutputFormat/OutputFormatConcatHls.cs

@ -32,8 +32,8 @@ public class OutputFormatConcatHls : IPipelineStep
return return
[ [
"-g", $"{OutputFormatHls.SegmentSeconds}/2", "-g", $"{OutputFormatHls.KeyframeIntervalSeconds}",
"-force_key_frames", $"expr:gte(t,n_forced*{OutputFormatHls.SegmentSeconds}/2)", "-force_key_frames", $"expr:gte(t,n_forced*{OutputFormatHls.KeyframeIntervalSeconds})",
"-f", "hls", "-f", "hls",
"-hls_segment_type", segmentType, "-hls_segment_type", segmentType,
//"-hls_init_time", "2", //"-hls_init_time", "2",

7
ErsatzTV.FFmpeg/OutputFormat/OutputFormatHls.cs

@ -6,6 +6,7 @@ namespace ErsatzTV.FFmpeg.OutputFormat;
public class OutputFormatHls : IPipelineStep public class OutputFormatHls : IPipelineStep
{ {
public const int SegmentSeconds = 4; public const int SegmentSeconds = 4;
public const int KeyframeIntervalSeconds = 2;
private readonly FrameState _desiredState; private readonly FrameState _desiredState;
private readonly bool _isFirstTranscode; private readonly bool _isFirstTranscode;
@ -55,7 +56,7 @@ public class OutputFormatHls : IPipelineStep
int gop = _oneSecondGop int gop = _oneSecondGop
? (int)Math.Round(frameRate.ParsedFrameRate) ? (int)Math.Round(frameRate.ParsedFrameRate)
: (int)Math.Round(frameRate.ParsedFrameRate * SegmentSeconds); : (int)Math.Round(frameRate.ParsedFrameRate * KeyframeIntervalSeconds);
List<string> result = []; List<string> result = [];
@ -64,8 +65,8 @@ public class OutputFormatHls : IPipelineStep
result.AddRange( result.AddRange(
[ [
"-g", $"{gop}", "-g", $"{gop}",
"-keyint_min", $"{(int)Math.Round(frameRate.ParsedFrameRate * SegmentSeconds)}", "-keyint_min", $"{(int)Math.Round(frameRate.ParsedFrameRate * KeyframeIntervalSeconds)}",
"-force_key_frames", $"expr:gte(t,n_forced*{SegmentSeconds})" "-force_key_frames", $"expr:gte(t,n_forced*{KeyframeIntervalSeconds})"
]); ]);
} }

9
ErsatzTV/Pages/FFmpegEditor.razor

@ -282,7 +282,14 @@
<div class="d-flex"> <div class="d-flex">
<MudText>Format</MudText> <MudText>Format</MudText>
</div> </div>
<MudSelect @bind-Value="_model.AudioFormat" For="@(() => _model.AudioFormat)"> @{
string helperText = string.Empty;
if (_model.AudioFormat is FFmpegProfileAudioFormat.AacLatm)
{
helperText = "aac (latm) is ONLY intended for DVB-C; anything else should use aac instead which uses ADTS";
}
}
<MudSelect @bind-Value="_model.AudioFormat" For="@(() => _model.AudioFormat)" HelperText="@helperText">
<MudSelectItem Value="@FFmpegProfileAudioFormat.Aac">aac</MudSelectItem> <MudSelectItem Value="@FFmpegProfileAudioFormat.Aac">aac</MudSelectItem>
<MudSelectItem Value="@FFmpegProfileAudioFormat.Ac3">ac3</MudSelectItem> <MudSelectItem Value="@FFmpegProfileAudioFormat.Ac3">ac3</MudSelectItem>
<MudSelectItem Value="@FFmpegProfileAudioFormat.AacLatm">aac (latm)</MudSelectItem> <MudSelectItem Value="@FFmpegProfileAudioFormat.AacLatm">aac (latm)</MudSelectItem>

Loading…
Cancel
Save