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/). @@ -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**
- 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
- Lower GOP size and keyframe interval from four seconds to two seconds in accordance with HLS2 draft spec recommendations
### Fixed
- 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 @@ -32,8 +32,8 @@ public class OutputFormatConcatHls : IPipelineStep
return
[
"-g", $"{OutputFormatHls.SegmentSeconds}/2",
"-force_key_frames", $"expr:gte(t,n_forced*{OutputFormatHls.SegmentSeconds}/2)",
"-g", $"{OutputFormatHls.KeyframeIntervalSeconds}",
"-force_key_frames", $"expr:gte(t,n_forced*{OutputFormatHls.KeyframeIntervalSeconds})",
"-f", "hls",
"-hls_segment_type", segmentType,
//"-hls_init_time", "2",

7
ErsatzTV.FFmpeg/OutputFormat/OutputFormatHls.cs

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

9
ErsatzTV/Pages/FFmpegEditor.razor

@ -282,7 +282,14 @@ @@ -282,7 +282,14 @@
<div class="d-flex">
<MudText>Format</MudText>
</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.Ac3">ac3</MudSelectItem>
<MudSelectItem Value="@FFmpegProfileAudioFormat.AacLatm">aac (latm)</MudSelectItem>

Loading…
Cancel
Save