feat(ui): 영상·오디오 인코딩 옵션 패널 — 출력 형식별 동적 노출
OptionsViewModel + 옵션 패널에 영상/오디오 인코딩 옵션을 선언적 바인딩으로 노출. - OptionsViewModel: 영상/오디오 ObservableProperty(코덱·레이트컨트롤·CRF·비트레이트·프리셋·해상도·fps· 회전·디인터레이스·faststart·SpatialAq / 오디오 코덱·비트레이트·VBR·샘플레이트·채널·loudnorm) + BuildVideo()/BuildAudio()로 VideoEncodeOptions/AudioEncodeOptions 구성, ToConvertOptions에 연결. - MainWindow.xaml: MediaPanel(VideoSubPanel/AudioSubPanel) — 레이트컨트롤 모드에 따라 CRF 슬라이더 ↔ 비트레이트 입력 DataTrigger 전환, 고급(회전/디인터레이스/SpatialAq)은 Expander. 전부 선언적 TwoWay 바인딩. - 코드비하인드: UpdateMediaPanelForFormat — 출력이 영상이면 영상+오디오, 오디오면 오디오만 노출. - 검증: 빌드 0/0, 106 테스트 그린, publish 후 메인 창 크래시 없이 로드. 옵션 실동작은 GUI 스모크 권장.
This commit is contained in:
parent
214789b656
commit
c10da19bfd
3 changed files with 211 additions and 1 deletions
|
|
@ -25,7 +25,28 @@ public partial class OptionsViewModel : ObservableObject
|
|||
|
||||
[ObservableProperty] private bool _videoPreferGpu = true;
|
||||
|
||||
/// <summary>현재 상태로 불변 ConvertOptions를 구성한다(기존 MainWindow.BuildOptions와 동일 동작).</summary>
|
||||
// ── 영상 인코딩 (출력이 영상 컨테이너일 때) ──────────────────────────────────────────────
|
||||
[ObservableProperty] private int _videoCodecIndex; // 0=Auto,1=H264,2=H265,3=VP9,4=AV1,5=Copy
|
||||
[ObservableProperty] private int _rateControlIndex; // 0=CRF,1=ABR,2=ConstrainedCRF,3=CBR,4=2pass
|
||||
[ObservableProperty] private int _crf = 23; // 0~51
|
||||
[ObservableProperty] private int _videoBitrateKbps = 8000;
|
||||
[ObservableProperty] private int _presetIndex = 5; // 0=UltraFast..8=VerySlow(기본 Medium)
|
||||
[ObservableProperty] private int _resolutionIndex; // 0=원본,1=2160p,2=1440p,3=1080p,4=720p,5=480p
|
||||
[ObservableProperty] private int _fpsIndex; // 0=원본,1=24,2=30,3=60
|
||||
[ObservableProperty] private int _rotateIndex; // 0=None,1=Cw90,2=Ccw90,3=180,4=FlipH,5=FlipV
|
||||
[ObservableProperty] private int _deinterlaceIndex; // 0=Off,1=Yadif,2=Bwdif
|
||||
[ObservableProperty] private bool _fastStart = true;
|
||||
[ObservableProperty] private bool _spatialAq = true;
|
||||
|
||||
// ── 오디오 인코딩 (영상의 오디오 트랙 + 오디오 전용 출력) ─────────────────────────────────
|
||||
[ObservableProperty] private int _audioCodecIndex; // 0=Auto,1=AAC,2=MP3,3=Opus,4=Vorbis,5=FLAC,6=PCM,7=Copy
|
||||
[ObservableProperty] private int _audioBitrateIndex = 2; // 0=96,1=128,2=192,3=256,4=320
|
||||
[ObservableProperty] private bool _audioVbr;
|
||||
[ObservableProperty] private int _sampleRateIndex; // 0=원본,1=44100,2=48000
|
||||
[ObservableProperty] private int _channelsIndex; // 0=원본,1=모노,2=스테레오
|
||||
[ObservableProperty] private bool _loudnorm;
|
||||
|
||||
/// <summary>현재 상태로 불변 ConvertOptions를 구성한다(기존 MainWindow.BuildOptions와 동일 동작 + 영상/오디오).</summary>
|
||||
public ConvertOptions ToConvertOptions()
|
||||
{
|
||||
var hasCustom = !string.IsNullOrWhiteSpace(CustomOutputDirectory);
|
||||
|
|
@ -50,6 +71,34 @@ public partial class OptionsViewModel : ObservableObject
|
|||
TargetLanguage = string.IsNullOrWhiteSpace(TargetLanguage) ? null : TargetLanguage.Trim(),
|
||||
},
|
||||
VideoPreferGpu = VideoPreferGpu,
|
||||
Video = BuildVideo(),
|
||||
Audio = BuildAudio(),
|
||||
};
|
||||
}
|
||||
|
||||
private VideoEncodeOptions BuildVideo() => new()
|
||||
{
|
||||
Codec = VideoCodecIndex switch { 1 => VideoCodec.H264, 2 => VideoCodec.H265, 3 => VideoCodec.Vp9, 4 => VideoCodec.Av1, 5 => VideoCodec.Copy, _ => VideoCodec.Auto },
|
||||
RateControl = RateControlIndex switch { 1 => RateControlMode.AverageBitrate, 2 => RateControlMode.ConstrainedCrf, 3 => RateControlMode.Cbr, 4 => RateControlMode.TwoPass, _ => RateControlMode.Crf },
|
||||
Crf = Math.Clamp(Crf, 0, 63),
|
||||
VideoBitrateKbps = VideoBitrateKbps,
|
||||
VideoMaxrateKbps = RateControlIndex == 2 ? VideoBitrateKbps : null, // 제약CRF는 비트레이트 입력을 상한으로
|
||||
Preset = (VideoSpeedPreset)Math.Clamp(PresetIndex, 0, 8),
|
||||
ScaleWidth = ResolutionIndex switch { 1 => 3840, 2 => 2560, 3 => 1920, 4 => 1280, 5 => 854, _ => (int?)null },
|
||||
Fps = FpsIndex switch { 1 => 24.0, 2 => 30.0, 3 => 60.0, _ => (double?)null },
|
||||
Rotate = (RotateMode)Math.Clamp(RotateIndex, 0, 5),
|
||||
Deinterlace = (DeinterlaceMode)Math.Clamp(DeinterlaceIndex, 0, 2),
|
||||
FastStart = FastStart,
|
||||
SpatialAq = SpatialAq,
|
||||
};
|
||||
|
||||
private AudioEncodeOptions BuildAudio() => new()
|
||||
{
|
||||
Codec = AudioCodecIndex switch { 1 => AudioCodec.Aac, 2 => AudioCodec.Mp3, 3 => AudioCodec.Opus, 4 => AudioCodec.Vorbis, 5 => AudioCodec.Flac, 6 => AudioCodec.Pcm, 7 => AudioCodec.Copy, _ => AudioCodec.Auto },
|
||||
RateMode = AudioVbr ? AudioRateMode.Vbr : AudioRateMode.Bitrate,
|
||||
AudioBitrateKbps = AudioBitrateIndex switch { 0 => 96, 1 => 128, 3 => 256, 4 => 320, _ => 192 },
|
||||
SampleRate = SampleRateIndex switch { 1 => 44100, 2 => 48000, _ => (int?)null },
|
||||
Channels = ChannelsIndex switch { 1 => 1, 2 => 2, _ => (int?)null },
|
||||
Loudnorm = Loudnorm,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue