export: H.264 color range toggle (fix dark/oversaturated output)
The zero-copy VAAPI encoder emitted full-range BT.709 NV12 but wrote no color
tags, so players assumed limited range and stretched it — the H.264 output
looked dark and oversaturated (preview and VP9/software were fine).
- Rgba2Nv12 takes `full_range` and applies the matching Y/chroma scale+offset
(limited 16-235 / full 0-255) via a uniform; the encoder sets color_range +
bt709 colorspace/primaries/transfer tags to match. ffprobe-confirmed.
- New ColorRange { Limited, Full } on VideoExportSettings (default Limited, the
universally-correct choice; serde(default) so saved settings still load),
surfaced as a "Color range" dropdown in advanced export settings for H.264.
The swscale software fallback still emits Limited regardless of the toggle
(Full only affects the VAAPI zero-copy path).
This commit is contained in:
@@ -6,7 +6,7 @@ use eframe::egui;
|
||||
use lightningbeam_core::export::{
|
||||
AudioExportSettings, AudioFormat,
|
||||
ImageExportSettings, ImageFormat,
|
||||
VideoExportSettings, VideoCodec, VideoQuality,
|
||||
VideoExportSettings, VideoCodec, VideoQuality, ColorRange,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -527,6 +527,20 @@ impl ExportDialog {
|
||||
});
|
||||
});
|
||||
|
||||
// Color range applies to H.264 (the VAAPI zero-copy encoder honors it). Limited/TV is the
|
||||
// compatible default; Full/PC only looks right in players that read the full-range tag.
|
||||
if matches!(self.video_settings.codec, VideoCodec::H264) {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Color range:");
|
||||
egui::ComboBox::from_id_salt("video_color_range")
|
||||
.selected_text(self.video_settings.color_range.name())
|
||||
.show_ui(ui, |ui| {
|
||||
ui.selectable_value(&mut self.video_settings.color_range, ColorRange::Limited, ColorRange::Limited.name());
|
||||
ui.selectable_value(&mut self.video_settings.color_range, ColorRange::Full, ColorRange::Full.name());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ui.checkbox(&mut self.include_audio, "Include Audio");
|
||||
|
||||
ui.add_space(8.0);
|
||||
|
||||
@@ -899,6 +899,7 @@ impl ExportOrchestrator {
|
||||
framerate.round() as i32,
|
||||
settings.quality.bitrate_kbps(),
|
||||
output_path,
|
||||
settings.color_range.is_full(),
|
||||
) {
|
||||
Ok(e) => e,
|
||||
Err(e) => {
|
||||
|
||||
Reference in New Issue
Block a user