a9eb360288
Encoder dual-output: StreamEnabled/RecordEnabled/RecordPath options; per-output ffmpeg block (stream ->flv, record ->mp4); throw unless at least one output. RecordingFile: auto-name ty-<yyyymmdd>-<start hhmm>-0000.mp4, rename-on-stop to ty-...-<len hhmmss>.mp4 with numeric-suffix on collision. LayoutStore persists record folder. MainViewModel: REC/ON-AIR pills, status light, single Start<->End button (replaces Start/Stop variants), StopStream no longer signs out, explicit session timer. About overlay widened. Sign In label + spacing before Start. Tests: 244 passed / 246 (2 pre-existing: AudioPipeline gains-mute, RoundClip). Build 0 warnings. Scope check clean. Memory-map correction (derived-solution rule, 2026-08-29): image-shrink recipe was never recorded when first done, so it was re-derived. Added Derived-solution/recipes rule to AGENTS.md; MyMistakes.md now a permanent recipes registry (records the verified WPF-imaging shrink recipe); schema.md rows MyMistakes as registry; ai.md points to the rule. README hero image replaced: 3.2MB screenshot -> 1400x794 -> 188KB docs/ytLlive-preview.jpg (JPEG q82).
48 lines
2.1 KiB
C#
48 lines
2.1 KiB
C#
namespace ytLive.Services.Encoder;
|
||
|
||
/// <summary>
|
||
/// Everything the FFmpeg subprocess encoder needs for one go-live (TASK 4 ship
|
||
/// step 3). <see cref="RtmpUrl"/> is the FULL ingestion URL — the reusable
|
||
/// stream's ingest address plus its stream key (<c>rtmp://a.rtmp.youtube.com/live2/<key></c>).
|
||
/// Resolution/FPS/bitrate come from the active quality tier; audio (TASK 9)
|
||
/// streams from the mixer through the named pipe <see cref="AudioPipeName"/>.
|
||
/// </summary>
|
||
public sealed class EncoderOptions
|
||
{
|
||
/// <summary>The audio pipe the mixer streams into; the args reference the
|
||
/// same name for ffmpeg's <c>-i</c>.</summary>
|
||
public const string DefaultAudioPipeName = "ytllive_audio";
|
||
|
||
public string RtmpUrl { get; init; } = string.Empty;
|
||
public int Width { get; init; } = 1920;
|
||
public int Height { get; init; } = 1080;
|
||
public int Fps { get; init; } = 60;
|
||
public int BitrateKbps { get; init; } = 8000;
|
||
|
||
/// <summary>Push to <see cref="RtmpUrl"/> (the ON-AIR side). Defaults on so
|
||
/// the pre-recording callers behave unchanged; the VM sets it from the ON-AIR
|
||
/// pill.</summary>
|
||
public bool StreamEnabled { get; init; } = true;
|
||
|
||
/// <summary>Write a local file at <see cref="RecordPath"/> (the REC side).
|
||
/// False unless the REC pill is on.</summary>
|
||
public bool RecordEnabled { get; init; }
|
||
|
||
/// <summary>Local MP4 output path for recording. Required when
|
||
/// <see cref="RecordEnabled"/> is true.</summary>
|
||
public string? RecordPath { get; init; }
|
||
|
||
/// <summary>H.264 encoder name for <c>-c:v</c>; the encoder probes and prefers
|
||
/// nvenc → qsv → amf → libopenh264 when not forced.</summary>
|
||
public string? VideoEncoder { get; init; }
|
||
|
||
public int AudioSampleRate { get; init; } = 48000;
|
||
public int AudioChannels { get; init; } = 2;
|
||
|
||
/// <summary>Name of the mixer's audio pipe (default <see cref="DefaultAudioPipeName"/>).</summary>
|
||
public string AudioPipeName { get; init; } = DefaultAudioPipeName;
|
||
|
||
/// <summary>GOP in frames = Fps × 4s — the YouTube keyframe ≤ 4s compliance bound.</summary>
|
||
public int GopSize => Fps * 4;
|
||
}
|