DLSS 5 Neural Rendering for Images & Video with Frame Generation, RTX Video Super Resolution, HDR, and Color Grading
TypeScript ai-upscalingdlssdlss-5dlss5dlssgframe-generationframe-interpolationimage-enhancementimage-upscalingneural-renderingnvidianvidia-dlss-5nvidia-rtxrtx-videortx-video-super-resolutionvideo-enhancementvideo-upscaling
Add files via upload
Merserkc53a7607cfe5
diff --git a/app.py b/app.pyindex ce303a9..970a574 100644--- a/app.py+++ b/app.py@@ -17,6 +17,7 @@ from src.images import (decode_image,take_image_preview,)+from src.naming import RENAME_MODESfrom src.runtime import (LOGS,OUTPUTS,@@ -34,10 +35,12 @@ from src.settings import ()from src.video import (ConversionOptions,+ DLSS_MODEL_PRESETS,NR_PRESETS,NR_STYLES,UPSCALING_CHOICES,convert_video,+ convert_videos,)@@ -59,7 +62,9 @@ APP_CSS = """/* Keep large upload batches compact: roughly three file rows, then scroll. */#image-upload-list .file-preview-holder,-#image-output-list .file-preview-holder {+#image-output-list .file-preview-holder,+#video-upload-list .file-preview-holder,+#video-output-list .file-preview-holder {max-height: 210px !important;overflow-x: hidden !important;overflow-y: auto !important;@@ -68,7 +73,9 @@ APP_CSS = """}#image-upload-list .file-preview,-#image-output-list .file-preview {+#image-output-list .file-preview,+#video-upload-list .file-preview,+#video-output-list .file-preview {max-height: none !important;}@@ -126,6 +133,10 @@ def _parse_automatic_mask(value: str) -> bool:return value == "On"+def rename_suffix_update(mode: str):+ return gr.update(interactive=mode == "Custom")++def _neural_values(settings: UISettings,) -> tuple[str, str, float, float, float, float, float, str]:@@ -141,6 +152,12 @@ def _neural_values()+def _shared_dlss_values(+ settings: UISettings,+) -> tuple[str, str, float, float, float, float, float, str, str]:+ return (*_neural_values(settings), settings.dlss_model_preset)++def persist_image_settings(nr_preset: str,nr_style: str,@@ -150,9 +167,12 @@ def persist_image_settings(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,image_format: str,image_quality: float,-) -> tuple[str, str, float, float, float, float, float, str]:+ rename_mode: str,+ custom_suffix: str,+) -> tuple[str, str, float, float, float, float, float, str, str]:global _CURRENT_SETTINGSwith _CONFIG_LOCK:current = _CURRENT_SETTINGS or load_settings(CONFIG_PATH)@@ -166,13 +186,16 @@ def persist_image_settings(skin_structure_strength=skin_structure_strength,upscaling_factor=upscaling_factor,automatic_mask=_parse_automatic_mask(automatic_mask),+ dlss_model_preset=dlss_model_preset,image_format=image_format,image_quality=int(image_quality),+ image_rename_mode=rename_mode,+ image_custom_suffix=custom_suffix,)if settings != current:save_settings(CONFIG_PATH, settings)_CURRENT_SETTINGS = settings- return _neural_values(settings)+ return _shared_dlss_values(settings)def persist_video_settings(@@ -184,10 +207,13 @@ def persist_video_settings(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,codec: str,container: str,quality: str,-) -> tuple[str, str, float, float, float, float, float, str]:+ rename_mode: str,+ custom_suffix: str,+) -> tuple[str, str, float, float, float, float, float, str, str]:global _CURRENT_SETTINGSwith _CONFIG_LOCK:current = _CURRENT_SETTINGS or load_settings(CONFIG_PATH)@@ -201,14 +227,17 @@ def persist_video_settings(skin_structure_strength=skin_structure_strength,upscaling_factor=upscaling_factor,automatic_mask=_parse_automatic_mask(automatic_mask),+ dlss_model_preset=dlss_model_preset,codec=codec,container=container,quality=quality,+ video_rename_mode=rename_mode,+ video_custom_suffix=custom_suffix,)if settings != current:save_settings(CONFIG_PATH, settings)_CURRENT_SETTINGS = settings- return _neural_values(settings)+ return _shared_dlss_values(settings)def reset_saved_settings() -> tuple:@@ -216,23 +245,27 @@ def reset_saved_settings() -> tuple:with _CONFIG_LOCK:save_settings(CONFIG_PATH, DEFAULT_SETTINGS)_CURRENT_SETTINGS = DEFAULT_SETTINGS- neural = _neural_values(DEFAULT_SETTINGS)+ shared = _shared_dlss_values(DEFAULT_SETTINGS)message = "All Image and Video settings were reset to defaults."return (- *neural,- *neural,+ *shared,+ *shared,DEFAULT_SETTINGS.image_format,DEFAULT_SETTINGS.image_quality,+ DEFAULT_SETTINGS.image_rename_mode,+ gr.update(value=DEFAULT_SETTINGS.image_custom_suffix, interactive=False),DEFAULT_SETTINGS.codec,DEFAULT_SETTINGS.container,DEFAULT_SETTINGS.quality,+ DEFAULT_SETTINGS.video_rename_mode,+ gr.update(value=DEFAULT_SETTINGS.video_custom_suffix, interactive=False),message,message,)def _process_video(- input_path: str,+ input_path: str | None,nr_preset: str,nr_style: str,nr_intensity: float,@@ -241,6 +274,7 @@ def _process_video(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,codec: str,container: str,quality: str,@@ -259,6 +293,7 @@ def _process_video(local_structure_strength=local_structure_strength,skin_structure_strength=skin_structure_strength,automatic_mask=_parse_automatic_mask(automatic_mask),+ dlss_model_preset=dlss_model_preset,upscaling_factor=upscaling_factor,codec="H.264" if is_preview else codec,container="MP4" if is_preview else container,@@ -276,15 +311,18 @@ def _process_video(traceback.print_exc()raise gr.Error(str(exc)) from excoutput_preview = result.output_path if options.container == "MP4" else None+ source_name = Path(input_path).nameif preview_frames is not None:return output_preview, (- f"One-frame preview complete on {result.gpu} in {result.elapsed_seconds:.1f}s. "+ f"One-frame preview complete for {source_name} on {result.gpu} "+ f"in {result.elapsed_seconds:.1f}s. "f"DLSS {result.dlss_mode}: {result.render_width}×{result.render_height} → "f"{result.output_width}×{result.output_height}. Signed feature 18 confirmed.")if is_preview:return output_preview, (- f"Preview complete: {result.frames} frames from the first {PREVIEW_SECONDS:g} seconds processed "+ f"Preview complete for {source_name}: {result.frames} frames from the first "+ f"{PREVIEW_SECONDS:g} seconds processed "f"on {result.gpu} in {result.elapsed_seconds:.1f}s. DLSS {result.dlss_mode}: "f"{result.render_width}×{result.render_height} → {result.output_width}×{result.output_height}. ""All frames returned success with signed feature 18 confirmed."@@ -310,6 +348,7 @@ def render_video(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,codec: str,container: str,quality: str,@@ -317,13 +356,136 @@ def render_video():return _process_video(input_path, nr_preset, nr_style, nr_intensity, local_tone_strength, local_structure_strength,- skin_structure_strength, upscaling_factor, automatic_mask, codec, container, quality,+ skin_structure_strength, upscaling_factor, automatic_mask, dlss_model_preset,+ codec, container, quality,progress, None, None)+def _normalize_video_paths(paths: list[str] | str | None) -> list[str]:+ if not paths:+ return []+ return [paths] if isinstance(paths, str) else list(paths)+++def first_video_path(paths: list[str] | str | None) -> str | None:+ normalized = _normalize_video_paths(paths)+ return normalized[0] if normalized else None+++def update_video_preview_mode(paths: list[str] | str | None):+ normalized = _normalize_video_paths(paths)+ single = len(normalized) == 1+ input_value = normalized[0] if single else None+ return (+ gr.update(value=input_value, visible=single),+ gr.update(value=None, visible=single),+ gr.update(visible=single),+ gr.update(visible=single),+ )+++def render_video_batch(+ input_paths: list[str] | str | None,+ nr_preset: str,+ nr_style: str,+ nr_intensity: float,+ local_tone_strength: float,+ local_structure_strength: float,+ skin_structure_strength: float,+ upscaling_factor: float,+ automatic_mask: str,+ dlss_model_preset: str,+ codec: str,+ container: str,+ quality: str,+ rename_mode: str,+ custom_suffix: str,+ progress=gr.Progress(track_tqdm=False),+) -> tuple[object, list[str], list[list[str]], str]:+ paths = _normalize_video_paths(input_paths)+ if not paths:+ raise gr.Error("Choose at least one video first.")+ options = ConversionOptions(+ nr_preset=nr_preset,+ nr_style=nr_style,+ nr_intensity=nr_intensity,+ local_tone_strength=local_tone_strength,+ local_structure_strength=local_structure_strength,+ skin_structure_strength=skin_structure_strength,+ automatic_mask=_parse_automatic_mask(automatic_mask),+ dlss_model_preset=dlss_model_preset,+ upscaling_factor=upscaling_factor,+ codec=codec,+ container=container,+ quality=quality,+ rename_mode=rename_mode,+ custom_suffix=custom_suffix,+ )++ def report(value: float, message: str) -> None:+ progress(value, desc=message)++ try:+ result = convert_videos(paths, options, progress=report)+ except Exception as exc:+ traceback.print_exc()+ raise gr.Error(str(exc)) from exc++ ordered_rows: list[tuple[int, list[str]]] = []+ for item in result.successes:+ conversion = item.result+ details = (+ f"{conversion.frames} frames in {conversion.elapsed_seconds:.1f}s; "+ f"DLSS {conversion.dlss_mode}: "+ f"{conversion.render_width}×{conversion.render_height} → "+ f"{conversion.output_width}×{conversion.output_height}; "+ f"report: {conversion.report_path}"+ )+ ordered_rows.append(+ (+ item.index,+ [+ Path(item.input_path).name,+ "Complete",+ Path(conversion.output_path).name,+ details,+ ],+ )+ )+ for item in result.failures:+ state = "Skipped" if item.error == "Cancelled before rendering." else (+ "Cancelled" if item.cancelled else "Failed"+ )+ ordered_rows.append(+ (item.index, [Path(item.input_path).name, state, "", item.error])+ )+ rows = [row for _index, row in sorted(ordered_rows, key=lambda entry: entry[0])]+ files = [item.result.output_path for item in result.successes]+ output_preview = None+ if len(paths) == 1 and result.successes:+ candidate = result.successes[0].result.output_path+ if Path(candidate).suffix.lower() == ".mp4":+ output_preview = candidate+ failed_count = sum(not item.cancelled for item in result.failures)+ cancelled_count = sum(+ item.cancelled and item.error != "Cancelled before rendering."+ for item in result.failures+ )+ skipped_count = sum(+ item.error == "Cancelled before rendering." for item in result.failures+ )+ state = "Cancelled" if result.cancelled else "Complete"+ status = (+ f"{state}: {len(result.successes)} completed, {failed_count} failed, "+ f"{cancelled_count} cancelled, {skipped_count} skipped. "+ f"Batch manifest: {result.manifest_path}"+ )+ return gr.update(value=output_preview, visible=len(paths) == 1), files, rows, status++def preview_video(- input_path: str,+ input_path: list[str] | str | None,nr_preset: str,nr_style: str,nr_intensity: float,@@ -332,20 +494,23 @@ def preview_video(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,codec: str,container: str,quality: str,progress=gr.Progress(track_tqdm=False),):+ selected = first_video_path(input_path)return _process_video(- input_path, nr_preset, nr_style, nr_intensity, local_tone_strength, local_structure_strength,- skin_structure_strength, upscaling_factor, automatic_mask, codec, container, quality,+ selected, nr_preset, nr_style, nr_intensity, local_tone_strength, local_structure_strength,+ skin_structure_strength, upscaling_factor, automatic_mask, dlss_model_preset,+ codec, container, quality,progress, PREVIEW_SECONDS, None)def preview_one_frame(- input_path: str,+ input_path: list[str] | str | None,nr_preset: str,nr_style: str,nr_intensity: float,@@ -354,14 +519,17 @@ def preview_one_frame(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,codec: str,container: str,quality: str,progress=gr.Progress(track_tqdm=False),):+ selected = first_video_path(input_path)return _process_video(- input_path, nr_preset, nr_style, nr_intensity, local_tone_strength, local_structure_strength,- skin_structure_strength, upscaling_factor, automatic_mask, codec, container, quality,+ selected, nr_preset, nr_style, nr_intensity, local_tone_strength, local_structure_strength,+ skin_structure_strength, upscaling_factor, automatic_mask, dlss_model_preset,+ codec, container, quality,progress, None, 1)@@ -393,8 +561,11 @@ def render_image_batch(skin_structure_strength: float,upscaling_factor: float,automatic_mask: str,+ dlss_model_preset: str,image_format: str,image_quality: float,+ rename_mode: str,+ custom_suffix: str,progress=gr.Progress(track_tqdm=False),):if not input_paths:@@ -409,9 +580,12 @@ def render_image_batch(local_structure_strength=local_structure_strength,skin_structure_strength=skin_structure_strength,automatic_mask=_parse_automatic_mask(automatic_mask),+ dlss_model_preset=dlss_model_preset,upscaling_factor=upscaling_factor,output_format=image_format,quality=int(image_quality),+ rename_mode=rename_mode,+ custom_suffix=custom_suffix,)def report(value: float, message: str) -> None:@@ -495,6 +669,18 @@ def build_neural_controls(settings: UISettings):]+def build_dlss_model_control(settings: UISettings):+ return gr.Dropdown(+ choices=list(DLSS_MODEL_PRESETS),+ value=settings.dlss_model_preset,+ label="DLSS Model Preset",+ info=(+ "Default lets NVIDIA select its normal mode-specific presets. "+ "J, K, L, or M forces that model preset for every DLSS scaling mode."+ ),+ )++def build_app() -> gr.Blocks:"""Build the UI from the cached settings without rewriting configuration."""global _CURRENT_SETTINGS@@ -534,6 +720,8 @@ def build_app() -> gr.Blocks:"DLSS 5 Neural Rendering Settings", open=True):image_neural = build_neural_controls(settings)+ with gr.Accordion("DLSS 5 Settings", open=True):+ image_model_preset = build_dlss_model_control(settings)with gr.Row():image_format = gr.Dropdown(list(IMAGE_FORMATS),@@ -555,6 +743,22 @@ def build_app() -> gr.Blocks:"Used by JPEG, WebP, and AVIF; ignored by PNG/TIFF."),)+ with gr.Row():+ image_rename_mode = gr.Radio(+ RENAME_MODES,+ value=settings.image_rename_mode,+ label="Rename",+ info=(+ "Auto adds the current DLSS5 timestamp; Copy keeps the "+ "original base name; Custom appends your suffix."+ ),+ )+ image_custom_suffix = gr.Textbox(+ value=settings.image_custom_suffix,+ label="Custom suffix",+ placeholder="_DLSS5",+ interactive=settings.image_rename_mode == "Custom",+ )gr.Markdown("Images are processed as 8-bit SDR sRGB. Animated and multipage ""files use their first frame/page."@@ -594,13 +798,25 @@ def build_app() -> gr.Blocks:with gr.Tab("Video", id="video"):with gr.Row():with gr.Column(scale=3):- video_source = gr.Video(- label="Input video", sources=["upload"], format=None+ video_sources = gr.File(+ label="Input video(s)",+ file_count="multiple",+ file_types=["video"],+ type="filepath",+ allow_reordering=True,+ elem_id="video-upload-list",+ )+ video_input_preview = gr.Video(+ label="Input video preview",+ interactive=False,+ visible=False,)with gr.Accordion("DLSS 5 Neural Rendering Settings", open=True):video_neural = build_neural_controls(settings)+ with gr.Accordion("DLSS 5 Settings", open=True):+ video_model_preset = build_dlss_model_control(settings)video_quality = gr.Radio(QUALITY_CHOICES,value=settings.quality,@@ -624,6 +840,22 @@ def build_app() -> gr.Blocks:value=settings.container,label="Container",)+ with gr.Row():+ video_rename_mode = gr.Radio(+ RENAME_MODES,+ value=settings.video_rename_mode,+ label="Rename",+ info=(+ "Auto adds the current DLSS5 timestamp; Copy keeps the "+ "original base name; Custom appends your suffix."+ ),+ )+ video_custom_suffix = gr.Textbox(+ value=settings.video_custom_suffix,+ label="Custom suffix",+ placeholder="_DLSS5",+ interactive=settings.video_rename_mode == "Custom",+ )gr.Checkbox(value=False,interactive=False,@@ -633,29 +865,77 @@ def build_app() -> gr.Blocks:),)with gr.Row():- video_preview_frame = gr.Button("Preview 1 frame")- video_preview = gr.Button("Preview 3 sec")- video_render = gr.Button("Render", variant="primary")+ video_preview_frame = gr.Button(+ "Preview 1 frame", visible=False+ )+ video_preview = gr.Button("Preview 3 sec", visible=False)+ video_render = gr.Button("Render video(s)", variant="primary")video_stop = gr.Button("Stop", variant="stop")video_reset = gr.Button("Reset settings")video_status = gr.Textbox(label="Status", interactive=False)with gr.Column(scale=3):- output_video = gr.Video(label="Output video", interactive=False)+ output_video = gr.Video(+ label="Output video",+ interactive=False,+ visible=False,+ )+ video_output_files = gr.File(+ label="Rendered video files",+ file_count="multiple",+ interactive=False,+ elem_id="video-output-list",+ )+ video_results = gr.Dataframe(+ headers=["Input", "Result", "Output", "Details"],+ datatype=["str", "str", "str", "str"],+ interactive=False,+ label="Batch results",+ wrap=True,+ )- image_inputs = [image_sources, *image_neural, image_format, image_quality]+ image_inputs = [+ image_sources,+ *image_neural,+ image_model_preset,+ image_format,+ image_quality,+ image_rename_mode,+ image_custom_suffix,+ ]video_inputs = [- video_source,+ video_sources,+ *video_neural,+ video_model_preset,+ video_codec,+ video_container,+ video_quality,+ video_rename_mode,+ video_custom_suffix,+ ]+ video_preview_inputs = [+ video_sources,*video_neural,+ video_model_preset,video_codec,video_container,video_quality,]- image_settings_inputs = [*image_neural, image_format, image_quality]+ image_settings_inputs = [+ *image_neural,+ image_model_preset,+ image_format,+ image_quality,+ image_rename_mode,+ image_custom_suffix,+ ]video_settings_inputs = [*video_neural,+ video_model_preset,video_codec,video_container,video_quality,+ video_rename_mode,+ video_custom_suffix,]image_sources.change(@@ -665,18 +945,42 @@ def build_app() -> gr.Blocks:queue=False,show_progress="hidden",)+ video_sources.change(+ update_video_preview_mode,+ inputs=video_sources,+ outputs=[+ video_input_preview,+ output_video,+ video_preview_frame,+ video_preview,+ ],+ queue=False,+ show_progress="hidden",+ )+ image_rename_mode.change(+ rename_suffix_update,+ inputs=image_rename_mode,+ outputs=image_custom_suffix,+ queue=False,+ )+ video_rename_mode.change(+ rename_suffix_update,+ inputs=video_rename_mode,+ outputs=video_custom_suffix,+ queue=False,+ )for component in image_settings_inputs:component.input(persist_image_settings,inputs=image_settings_inputs,- outputs=video_neural,+ outputs=[*video_neural, video_model_preset],queue=False,)for component in video_settings_inputs:component.input(persist_video_settings,inputs=video_settings_inputs,- outputs=image_neural,+ outputs=[*image_neural, image_model_preset],queue=False,)@@ -695,20 +999,20 @@ def build_app() -> gr.Blocks:image_stop.click(cancel_active_job, outputs=image_status, queue=False)video_render.click(- render_video,+ render_video_batch,inputs=video_inputs,- outputs=[output_video, video_status],+ outputs=[output_video, video_output_files, video_results, video_status],concurrency_limit=1,)video_preview.click(preview_video,- inputs=video_inputs,+ inputs=video_preview_inputs,outputs=[output_video, video_status],concurrency_limit=1,)video_preview_frame.click(preview_one_frame,- inputs=video_inputs,+ inputs=video_preview_inputs,outputs=[output_video, video_status],concurrency_limit=1,)@@ -716,12 +1020,18 @@ def build_app() -> gr.Blocks:reset_outputs = [*image_neural,+ image_model_preset,*video_neural,+ video_model_preset,image_format,image_quality,+ image_rename_mode,+ image_custom_suffix,video_codec,video_container,video_quality,+ video_rename_mode,+ video_custom_suffix,image_status,video_status,]diff --git a/src/__init__.py b/src/__init__.pyindex 5558673..350ba42 100644--- a/src/__init__.py+++ b/src/__init__.py@@ -10,11 +10,22 @@ from .images import (convert_images,probe_image,)-from .video import ConversionOptions, ConversionResult, convert_video+from .video import (+ ConversionOptions,+ ConversionResult,+ VideoBatchResult,+ VideoConversionFailure,+ VideoConversionSuccess,+ convert_video,+ convert_videos,+)__all__ = ["ConversionOptions","ConversionResult",+ "VideoBatchResult",+ "VideoConversionFailure",+ "VideoConversionSuccess","ImageBatchResult","ImageConversionOptions","ImageConversionResult",@@ -22,6 +33,7 @@ __all__ = ["convert_image","convert_images","convert_video",+ "convert_videos","probe_image","probe_video",]diff --git a/src/images.py b/src/images.pyindex f31f54d..1bfe18c 100644--- a/src/images.py+++ b/src/images.py@@ -18,8 +18,9 @@ import numpy as npimport pillow_heifimport rawpyimport resvg_py-from PIL import Image, ImageCms, ImageOps+from PIL import Image, ImageCms, ImageOps, TiffImagePlugin+from .naming import output_filename, require_available_output, validate_renamefrom .runtime import (LOGS,OUTPUTS,@@ -33,6 +34,7 @@ from .runtime import ()from .video import (ConversionOptions,+ DLSS_MODEL_PRESETS,resolve_native_settings,resolve_output_size,resolve_upscaling_mode,@@ -70,6 +72,9 @@ class ImageConversionOptions:warmup_frames: int = 0nr_preset: str = "Default"automatic_mask: bool = False+ rename_mode: str = "Auto"+ custom_suffix: str = "_DLSS5"+ dlss_model_preset: str = "Default"def neural_options(self) -> ConversionOptions:return ConversionOptions(@@ -82,6 +87,7 @@ class ImageConversionOptions:automatic_mask=self.automatic_mask,upscaling_factor=self.upscaling_factor,warmup_frames=self.warmup_frames,+ dlss_model_preset=self.dlss_model_preset,)@@ -101,6 +107,8 @@ class ImageConversionResult:upscaling_factor: floatdlss_mode: stroutput_format: str+ dlss_model_preset: str = "Default"+ applied_dlss_model_preset: int = 0warnings: list[str] = field(default_factory=list)@@ -151,6 +159,21 @@ def _report_data(decoded: _DecodedImage) -> _ImageReportData:return _ImageReportData(decoded.decoder, decoded.metadata, decoded.warnings)+def _json_safe_metadata(value: object) -> object:+ """Create a report-only JSON-safe copy without changing save metadata."""+ if value is None or isinstance(value, (bool, int, float, str)):+ return value+ if isinstance(value, TiffImagePlugin.IFDRational):+ return float(value)+ if isinstance(value, dict):+ return {str(key): _json_safe_metadata(item) for key, item in value.items()}+ if isinstance(value, (list, tuple, set)):+ return [_json_safe_metadata(item) for item in value]+ if isinstance(value, bytes):+ return {"type": "bytes", "length": len(value)}+ return str(value)++def _validate_options(options: ImageConversionOptions) -> ConversionOptions:if options.output_format not in IMAGE_FORMATS:raise ValueError(f"Unknown image output format: {options.output_format!r}.")@@ -162,6 +185,7 @@ def _validate_options(options: ImageConversionOptions) -> ConversionOptions:raise ValueError("Image quality must be an integer from 1 to 100.") from excif quality != options.quality or not 1 <= quality <= 100:raise ValueError("Image quality must be an integer from 1 to 100.")+ validate_rename(options.rename_mode, options.custom_suffix)neural = options.neural_options()resolve_native_settings(neural)resolve_upscaling_mode(neural.upscaling_factor)@@ -390,10 +414,23 @@ def save_image(return warnings-def _output_path(source: Path, output_format: str, stamp: str, index: int) -> Path:+def _output_path(+ source: Path,+ output_format: str,+ stamp: str,+ index: int,+ rename_mode: str,+ custom_suffix: str,+) -> Path:suffix = IMAGE_EXTENSIONS[output_format]safe_stem = source.stem.strip().rstrip(".") or "image"- return OUTPUTS / f"{safe_stem}_DLSS5_IMAGE_{stamp}-{index + 1:04d}{suffix}"+ return OUTPUTS / output_filename(+ source,+ suffix,+ rename_mode,+ custom_suffix,+ f"{safe_stem}_DLSS5_IMAGE_{stamp}-{index + 1:04d}",+ )def _write_report(@@ -412,7 +449,7 @@ def _write_report("gpu": gpu,"decoder": decoded.decoder,"source_metadata": {- key: value+ key: _json_safe_metadata(value)for key, value in decoded.metadata.items()if key not in {"icc_profile", "exif", "xmp"}},@@ -426,12 +463,25 @@ def _write_report("output_dimensions": {"width": result.output_width, "height": result.output_height},"dlss_mode": result.dlss_mode,"requested_upscaling_factor": result.upscaling_factor,+ "dlss_model_preset": result.dlss_model_preset,+ "requested_dlss_model_preset": result.dlss_model_preset,+ "requested_dlss_model_preset_code": DLSS_MODEL_PRESETS[+ result.dlss_model_preset+ ],+ "applied_dlss_model_preset": result.applied_dlss_model_preset,+ "applied_dlss_model_preset_name": next(+ name+ for name, code in DLSS_MODEL_PRESETS.items()+ if code == result.applied_dlss_model_preset+ ),"pipeline": "renodx-dlssnr-feature18-image","feature_id": 18,"feature_18_confirmed": True,"ngx_setup_result": f"0x{session.setup_result:08X}","carrier_create_result": evidence["carrier_create_result"],"native_settings": session.native_settings,+ "addon_release": session.runtime_bundle["addon"]["release"],+ "addon_sha256": session.runtime_bundle["addon"]["sha256"].lower(),"model_sha256": session.runtime_bundle["neural_runtime"]["sha256"].lower(),"worker_sha256": session.runtime_bundle["worker"]["sha256"].lower(),"worker_log": session.worker_logs,@@ -516,6 +566,36 @@ def convert_images(except Exception as exc:failures_by_index[index] = ImageConversionFailure(str(path), str(exc))+ planned_outputs: dict[int, Path] = {}+ reserved_outputs: set[str] = set()+ available_probes: list[_ImageProbe] = []+ for probe in probes:+ output = _output_path(+ probe.path,+ options.output_format,+ stamp,+ probe.index,+ options.rename_mode,+ options.custom_suffix,+ )+ output_key = str(output.resolve()).casefold()+ try:+ require_available_output(output)+ if output_key in reserved_outputs:+ raise FileExistsError(+ f"More than one input would create {output.name}. "+ "Choose Auto naming or use unique input names."+ )+ except Exception as exc:+ failures_by_index[probe.index] = ImageConversionFailure(+ str(probe.path), str(exc)+ )+ continue+ reserved_outputs.add(output_key)+ planned_outputs[probe.index] = output+ available_probes.append(probe)+ probes = available_probes+if not probes:manifest_path, zip_path = _build_manifest_and_zip(stamp, options, [], list(failures_by_index.values()), False@@ -658,7 +738,7 @@ def convert_images())processed[..., 3] = alpha- output = _output_path(item.path, options.output_format, stamp, item.index)+ output = planned_outputs[item.index]result = ImageConversionResult(str(item.path),str(output),@@ -674,6 +754,8 @@ def convert_images(float(options.upscaling_factor),str(session.mode["name"]),options.output_format,+ options.dlss_model_preset,+ session.applied_dlss_model_preset,list(decoded.warnings),)encoding = encode_executor.submit(diff --git a/src/naming.py b/src/naming.pynew file mode 100644index 0000000..7128653--- /dev/null+++ b/src/naming.py@@ -0,0 +1,49 @@+from __future__ import annotations++from pathlib import Path+++RENAME_MODES = ("Auto", "Copy", "Custom")+_INVALID_FILENAME_CHARACTERS = set('<>:"/\\|?*')+++def validate_rename(mode: str, custom_suffix: str) -> str:+ if mode not in RENAME_MODES:+ choices = ", ".join(RENAME_MODES)+ raise ValueError(f"Rename must be one of: {choices}.")+ suffix = str(custom_suffix or "")+ if mode != "Custom":+ return suffix+ if not suffix:+ raise ValueError("Enter a suffix when Rename is set to Custom.")+ if any(character in _INVALID_FILENAME_CHARACTERS or ord(character) < 32 for character in suffix):+ raise ValueError('Custom suffix cannot contain < > : " / \\ | ? * or control characters.')+ if suffix.endswith((" ", ".")):+ raise ValueError("Custom suffix cannot end with a space or period.")+ return suffix+++def output_filename(+ source: Path,+ extension: str,+ mode: str,+ custom_suffix: str,+ auto_stem: str,+) -> str:+ suffix = validate_rename(mode, custom_suffix)+ if not extension.startswith("."):+ raise ValueError("Output extension must start with a period.")+ if mode == "Auto":+ stem = auto_stem+ else:+ stem = source.stem.strip().rstrip(".") or "output"+ if mode == "Custom":+ stem += suffix+ return f"{stem}{extension}"+++def require_available_output(path: Path) -> None:+ if path.exists():+ raise FileExistsError(+ f"Output already exists: {path.name}. Rename or remove the existing file first."+ )diff --git a/src/runtime.py b/src/runtime.pyindex 1123b39..40d98ac 100644--- a/src/runtime.py+++ b/src/runtime.py@@ -29,7 +29,7 @@ LOGS = ROOT / "logs"JOBS = ROOT / "jobs"EXPECTED_AMPERE_ADDON_SHA256 = (- "245C06137AD13B1CA03AFAAD5100C1E8F0DCE8C11FE50A9272EA562F33CEA601"+ "D5ADF82EB44B065F4C590AC91FE824BAB07AFEA0EB9F994BDE936710C8593952")EXPECTED_AMPERE_NEURAL_SHA256 = ("6EB209E764F39872625DEBD6ABAF45E2BB6322F6F270F781F70C059AE30B3927"@@ -38,12 +38,12 @@ EXPECTED_AMPERE_NEURAL_SHA256 = (_FINGERPRINT_LOCK = threading.Lock()_FINGERPRINT_CACHE: dict[tuple[str, int, int], str] = {}-VIDEO_MAGIC = 0x33563544-SETUP_MAGIC = 0x33505553+VIDEO_MAGIC = 0x34563544+SETUP_MAGIC = 0x34505553FRAME_MAGIC = 0x314D5246OUT_MAGIC = 0x3154554F-VIDEO_HEADER_FORMAT = "<13I4f"-SETUP_RESPONSE_FORMAT = "<11I"+VIDEO_HEADER_FORMAT = "<14I4f"+SETUP_RESPONSE_FORMAT = "<12I"def _file_sha256(path: Path) -> str:@@ -90,8 +90,8 @@ def inspect_runtime_bundle("sha256": addon_hash,"expected_sha256": EXPECTED_AMPERE_ADDON_SHA256,"matches_expected": addon_hash == EXPECTED_AMPERE_ADDON_SHA256,- "version": "4.60",- "release": "RenoDX DLSS5 v4.60",+ "version": "4.70",+ "release": "RenoDX DLSS5 v4.70",},"neural_runtime": {"path": str(neural.resolve()),@@ -118,7 +118,7 @@ def validate_gpu_runtime(neural_hash = inspected["neural_runtime"]["sha256"]raise RuntimeError(f"{gpu.get('name', 'RTX 30-series GPU')} requires the tested experimental Ampere "- "runtime pair: RenoDX DLSS5 v4.60 plus DLSS NR 310.8.SF-v2. "+ "runtime pair: RenoDX DLSS5 v4.70 plus DLSS NR 310.8.SF-v2. "f"Installed hashes are add-on {addon_hash} and neural runtime {neural_hash}. ""Restore the matching runtime files before rendering.")@@ -150,7 +150,7 @@ def classify_worker_failure()if runtime_bundle.get("known_ampere_pair"):summary += (- " The tested v4.60/SF-v2 component pair is installed. Update to the latest "+ " The tested v4.70/SF-v2 component pair is installed. Update to the latest ""NVIDIA driver; if the failure remains, this closed community runtime is ""incompatible with this Ampere system and there is no truthful non-neural fallback.")@@ -298,6 +298,7 @@ class BoundedLogBuffer:_IMPORTANT = ("profile applied",+ "model preset","DLSS 5 add-on","carrier ready","stream source",@@ -516,6 +517,7 @@ class DLSSFrameSession:int(warmup_frames),frame_count,int(mode["perf_quality"]),+ int(native["dlss_model_preset"]),native["profile"],native["preset"],native["style"],@@ -542,7 +544,7 @@ class DLSSFrameSession:or "The worker produced no diagnostic output.")raise RuntimeError(- "The native worker is incompatible with the version-3 upscaling protocol "+ "The native worker is incompatible with the version-4 model-preset protocol "f"or failed during DLSS setup (exit {worker_code}):\n{details}") from exc(@@ -557,10 +559,11 @@ class DLSSFrameSession:self.minimum_height,self.maximum_width,self.maximum_height,+ self.applied_dlss_model_preset,) = struct.unpack(SETUP_RESPONSE_FORMAT, setup_data)if setup_magic != SETUP_MAGIC:raise RuntimeError(- "The installed native worker does not support the version-3 upscaling protocol. "+ "The installed native worker does not support the version-4 model-preset protocol. ""Rebuild it.")if not setup_ok:@@ -578,6 +581,13 @@ class DLSSFrameSession:raise RuntimeError("The native worker returned output dimensions different from the request.")+ requested_model_preset = int(native["dlss_model_preset"])+ if self.applied_dlss_model_preset != requested_model_preset:+ raise RuntimeError(+ "The native worker acknowledged DLSS model preset "+ f"{self.applied_dlss_model_preset} instead of the requested "+ f"{requested_model_preset}."+ )if self.render_width < 64 or self.render_height < 64:raise RuntimeError(f"DLSS returned an unsupported render size: "diff --git a/src/settings.py b/src/settings.pyindex 7a83597..7a554db 100644--- a/src/settings.py+++ b/src/settings.py@@ -7,7 +7,9 @@ from dataclasses import dataclassfrom pathlib import Pathfrom .ffmpeg import ENCODING_QUALITIES+from .naming import RENAME_MODES, validate_renamefrom .video import (+ DLSS_MODEL_PRESETS,NR_PRESETS,NR_STYLES,ConversionOptions,@@ -38,10 +40,15 @@ class UISettings:image_quality: int = 95nr_preset: str = "Default"automatic_mask: bool = False+ image_rename_mode: str = "Auto"+ image_custom_suffix: str = "_DLSS5"+ video_rename_mode: str = "Auto"+ video_custom_suffix: str = "_DLSS5"+ dlss_model_preset: str = "Default"def component_values(self,- ) -> tuple[str, str, float, float, float, float, float, bool, str, str, str]:+ ) -> tuple[str, str, float, float, float, float, float, bool, str, str, str, str]:return (self.nr_preset,self.nr_style,@@ -54,6 +61,7 @@ class UISettings:self.codec,self.container,self.quality,+ self.dlss_model_preset,)@@ -71,6 +79,7 @@ def _validate(settings: UISettings) -> UISettings:skin_structure_strength=settings.skin_structure_strength,automatic_mask=settings.automatic_mask,upscaling_factor=settings.upscaling_factor,+ dlss_model_preset=settings.dlss_model_preset,))resolve_upscaling_mode(settings.upscaling_factor)@@ -89,6 +98,8 @@ def _validate(settings: UISettings) -> UISettings:raise ValueError("Image quality must be an integer from 1 to 100.")if int(settings.image_quality) != settings.image_quality:raise ValueError("Image quality must be an integer from 1 to 100.")+ validate_rename(settings.image_rename_mode, settings.image_custom_suffix)+ validate_rename(settings.video_rename_mode, settings.video_custom_suffix)return settings@@ -131,6 +142,29 @@ def load_settings(path: str | os.PathLike[str]) -> UISettings:parsed = configparser.ConfigParser.BOOLEAN_STATES.get(str(raw_value).casefold())return parsed if parsed is not None else default+ image_rename_mode = choice(+ "image_rename_mode", RENAME_MODES, DEFAULT_SETTINGS.image_rename_mode+ )+ image_custom_suffix = section.get(+ "image_custom_suffix", DEFAULT_SETTINGS.image_custom_suffix+ )+ video_rename_mode = choice(+ "video_rename_mode", RENAME_MODES, DEFAULT_SETTINGS.video_rename_mode+ )+ video_custom_suffix = section.get(+ "video_custom_suffix", DEFAULT_SETTINGS.video_custom_suffix+ )+ try:+ validate_rename(image_rename_mode, image_custom_suffix)+ except ValueError:+ image_rename_mode = DEFAULT_SETTINGS.image_rename_mode+ image_custom_suffix = DEFAULT_SETTINGS.image_custom_suffix+ try:+ validate_rename(video_rename_mode, video_custom_suffix)+ except ValueError:+ video_rename_mode = DEFAULT_SETTINGS.video_rename_mode+ video_custom_suffix = DEFAULT_SETTINGS.video_custom_suffix+return UISettings(nr_preset=choice("nr_preset", tuple(NR_PRESETS), DEFAULT_SETTINGS.nr_preset),nr_style=choice("nr_style", tuple(NR_STYLES), DEFAULT_SETTINGS.nr_style),@@ -153,6 +187,15 @@ def load_settings(path: str | os.PathLike[str]) -> UISettings:"image_format", IMAGE_FORMAT_CHOICES, DEFAULT_SETTINGS.image_format),image_quality=image_quality(),+ dlss_model_preset=choice(+ "dlss_model_preset",+ tuple(DLSS_MODEL_PRESETS),+ DEFAULT_SETTINGS.dlss_model_preset,+ ),+ image_rename_mode=image_rename_mode,+ image_custom_suffix=image_custom_suffix,+ video_rename_mode=video_rename_mode,+ video_custom_suffix=video_custom_suffix,)@@ -175,6 +218,11 @@ def save_settings(path: str | os.PathLike[str], settings: UISettings) -> None:"quality": settings.quality,"image_format": settings.image_format,"image_quality": str(settings.image_quality),+ "image_rename_mode": settings.image_rename_mode,+ "image_custom_suffix": settings.image_custom_suffix,+ "video_rename_mode": settings.video_rename_mode,+ "video_custom_suffix": settings.video_custom_suffix,+ "dlss_model_preset": settings.dlss_model_preset,}temporary = config_path.with_name(f".{config_path.name}.tmp")diff --git a/src/video.py b/src/video.pyindex 19ff875..7b59914 100644--- a/src/video.py+++ b/src/video.py@@ -7,17 +7,18 @@ import queueimport shutilimport threadingimport time-from contextlib import suppress+from contextlib import nullcontext, suppressfrom dataclasses import asdict, dataclassfrom fractions import Fractionfrom pathlib import Path-from typing import Callable+from typing import Callable, Iterableimport avimport cv2import numpy as npfrom . import ffmpeg+from .naming import output_filename, require_available_output, validate_renamefrom .runtime import (JOBS,LOGS,@@ -56,6 +57,9 @@ class ConversionOptions:preview_frames: int | None = Nonenr_preset: str = "Default"automatic_mask: bool = False+ rename_mode: str = "Auto"+ custom_suffix: str = "_DLSS5"+ dlss_model_preset: str = "Default"NR_PRESETS = {@@ -71,6 +75,14 @@ NR_STYLES = {"Cinematic": 2,}+DLSS_MODEL_PRESETS = {+ "Default": 0,+ "J": 10,+ "K": 11,+ "L": 12,+ "M": 13,+}+UPSCALING_MODES = {1.0: {"label": "1× (DLAA / native)", "name": "DLAA", "perf_quality": 5},1.5: {"label": "1.5× (Quality)", "name": "Quality", "perf_quality": 2},@@ -160,6 +172,15 @@ def resolve_native_settings(options: ConversionOptions) -> dict[str, int | floatf"Unknown NR Style: {options.nr_style!r}. Choose one of: {choices}.") from exc+ try:+ model_preset = DLSS_MODEL_PRESETS[options.dlss_model_preset]+ except KeyError as exc:+ choices = ", ".join(DLSS_MODEL_PRESETS)+ raise ValueError(+ f"Unknown DLSS Model Preset: {options.dlss_model_preset!r}. "+ f"Choose one of: {choices}."+ ) from exc+controls = {"NR Intensity": (options.nr_intensity, 0.0, 2.0),"Local Tone Strength": (options.local_tone_strength, 0.0, 2.0),@@ -191,6 +212,7 @@ def resolve_native_settings(options: ConversionOptions) -> dict[str, int | float"local_tone": validated["Local Tone Strength"],"local_structure": validated["Local Structure Strength"],"skin_structure": validated["Skin Structure Strength"],+ "dlss_model_preset": model_preset,}@@ -210,6 +232,34 @@ class ConversionResult:output_height: intupscaling_factor: floatdlss_mode: str+ dlss_model_preset: str = "Default"+ applied_dlss_model_preset: int = 0+++@dataclass(slots=True)+class VideoConversionSuccess:+ index: int+ input_path: str+ result: ConversionResult+++@dataclass(slots=True)+class VideoConversionFailure:+ index: int+ input_path: str+ error: str+ cancelled: bool = False+++@dataclass(slots=True)+class VideoBatchResult:+ successes: list[VideoConversionSuccess]+ failures: list[VideoConversionFailure]+ cancelled: bool+ manifest_path: str+++_BATCH_CONTEXT = threading.local()@dataclass(slots=True)@@ -310,6 +360,7 @@ def convert_video(if not source.is_file():raise FileNotFoundError(source)validate_codec_container(options.codec, options.container)+ validate_rename(options.rename_mode, options.custom_suffix)preview_seconds, preview_frames = _validate_preview_options(options)is_preview = preview_seconds is not None or preview_frames is not Noneif options.preserve_hdr:@@ -317,9 +368,14 @@ def convert_video("HDR preservation is disabled in this build because the verified DLSSNR path is ""RGBA8. HDR input is converted to SDR instead of being mislabeled as HDR.")- prepared_runtime = prepare_runtime()-- with active_job() as controller:+ prepared_runtime = getattr(_BATCH_CONTEXT, "prepared_runtime", None)+ if prepared_runtime is None:+ prepared_runtime = prepare_runtime()+ batch_controller = getattr(_BATCH_CONTEXT, "controller", None)+ job_context = nullcontext(batch_controller) if batch_controller is not None else active_job()++ with job_context as controller:+ assert controller is not Nonestarted = time.perf_counter()timings: dict[str, float] = {}job_dir: Path | None = None@@ -383,7 +439,14 @@ def convert_video(else "DLSS5_PREVIEW"))- output = OUTPUTS / f"{source.stem}_{output_kind}_{stamp}{extension}"+ output = OUTPUTS / output_filename(+ source,+ extension,+ options.rename_mode,+ options.custom_suffix,+ f"{source.stem}_{output_kind}_{stamp}",+ )+ require_available_output(output)temp_video = job_dir / "processed-video.mkv"native = resolve_native_settings(options)if progress:@@ -708,6 +771,15 @@ def convert_video(else ("preview-frame" if preview_frames is not None else "preview")),"dlss_mode": mode["name"],+ "dlss_model_preset": options.dlss_model_preset,+ "requested_dlss_model_preset": options.dlss_model_preset,+ "requested_dlss_model_preset_code": native["dlss_model_preset"],+ "applied_dlss_model_preset": session.applied_dlss_model_preset,+ "applied_dlss_model_preset_name": next(+ name+ for name, code in DLSS_MODEL_PRESETS.items()+ if code == session.applied_dlss_model_preset+ ),"requested_upscaling_factor": factor,"input_dimensions": {"width": input_width, "height": input_height},"negotiated_render_dimensions": {@@ -733,6 +805,8 @@ def convert_video("feature_18_confirmed": True,"carrier_create_result": carrier_create_result,"successful_neural_rendering_frames": nr_count,+ "addon_release": runtime_bundle["addon"]["release"],+ "addon_sha256": runtime_bundle["addon"]["sha256"].lower(),"model_sha256": runtime_bundle["neural_runtime"]["sha256"].lower(),"worker_sha256": runtime_bundle["worker"]["sha256"].lower(),"loaded_module_inventory": [@@ -771,11 +845,16 @@ def convert_video(output_height,factor,str(mode["name"]),+ options.dlss_model_preset,+ session.applied_dlss_model_preset,)except Exception as exc:was_cancelled = controller.cancel.is_set()pipeline_stop.set()- controller.stop()+ if controller.cancel.is_set():+ controller.stop()+ else:+ controller.terminate_processes()for target in (prepared_frames if "prepared_frames" in locals() else None,rendered_frames if "rendered_frames" in locals() else None):if target is not None:@@ -814,3 +893,122 @@ def convert_video(pipeline_stop.set()if job_dir and job_dir.exists():shutil.rmtree(job_dir, ignore_errors=True)+++def _write_video_batch_manifest(+ stamp: str,+ options: ConversionOptions,+ successes: list[VideoConversionSuccess],+ failures: list[VideoConversionFailure],+ cancelled: bool,+) -> str:+ LOGS.mkdir(exist_ok=True)+ manifest = {+ "status": "cancelled" if cancelled else ("partial" if failures else "success"),+ "options": asdict(options),+ "successes": [asdict(item) for item in successes],+ "failures": [asdict(item) for item in failures],+ }+ manifest_path = LOGS / f"DLSS5_VIDEO_BATCH_{stamp}.manifest.json"+ manifest_path.write_text(json.dumps(manifest, indent=2), encoding="utf-8")+ return str(manifest_path)+++def convert_videos(+ input_paths: Iterable[str | os.PathLike[str]],+ options: ConversionOptions | None = None,+ progress: Callable[[float, str], None] | None = None,+) -> VideoBatchResult:+ """Convert videos sequentially while holding one cancellable GPU batch slot."""+ from .prepare import prepare_runtime++ options = options or ConversionOptions()+ paths = [Path(path).resolve() for path in input_paths]+ if not paths:+ raise ValueError("Choose at least one video.")++ prepared_runtime = prepare_runtime()+ LOGS.mkdir(exist_ok=True)+ stamp = time.strftime("%Y%m%d-%H%M%S") + f"-{time.time_ns() % 1_000_000:06d}"+ successes: list[VideoConversionSuccess] = []+ failures: list[VideoConversionFailure] = []+ cancelled = False+ total = len(paths)++ with active_job() as controller:+ if getattr(_BATCH_CONTEXT, "controller", None) is not None:+ raise RuntimeError("A video batch is already active on this worker thread.")+ _BATCH_CONTEXT.controller = controller+ _BATCH_CONTEXT.prepared_runtime = prepared_runtime+ try:+ for index, path in enumerate(paths):+ position = index + 1+ prefix = f"[{position}/{total}] {path.name}"+ if controller.cancel.is_set():+ cancelled = True+ failures.extend(+ VideoConversionFailure(+ queued_index,+ str(queued),+ "Cancelled before rendering.",+ cancelled=True,+ )+ for queued_index, queued in enumerate(paths[index:], start=index)+ )+ break++ def report_item(+ value: float,+ message: str,+ *,+ item_index: int = index,+ item_prefix: str = prefix,+ ) -> None:+ bounded = min(1.0, max(0.0, float(value)))+ overall = (item_index + bounded) / total+ if progress:+ progress(overall, f"{item_prefix} — {message}")++ if progress:+ progress(index / total, f"{prefix} — starting")+ try:+ result = convert_video(path, options, progress=report_item)+ except Cancelled:+ cancelled = True+ failures.append(+ VideoConversionFailure(+ index,+ str(path),+ "Cancelled during rendering.",+ cancelled=True,+ )+ )+ failures.extend(+ VideoConversionFailure(+ queued_index,+ str(queued),+ "Cancelled before rendering.",+ cancelled=True,+ )+ for queued_index, queued in enumerate(paths[position:], start=position)+ )+ break+ except Exception as exc:+ failures.append(VideoConversionFailure(index, str(path), str(exc)))+ if progress:+ progress(position / total, f"{prefix} — failed")+ continue++ successes.append(VideoConversionSuccess(index, str(path), result))+ if progress:+ progress(position / total, f"{prefix} — complete")+ finally:+ del _BATCH_CONTEXT.controller+ del _BATCH_CONTEXT.prepared_runtime++ manifest_path = _write_video_batch_manifest(+ stamp, options, successes, failures, cancelled+ )+ if progress:+ progress(1.0, "Cancelled" if cancelled else "Complete")+ return VideoBatchResult(successes, failures, cancelled, manifest_path)