Compare commits

...
2 Commits
7 changed files with 126 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
# DOGMA 1.0.58
Add `DOGMASeedanceVideoFix`, a standalone native VIDEO adapter for the existing 1.0.57 stutter repair. It takes only the generated video and returns the corrected video, with progress, cancellation and a clear result status. No API jobs or original-footage input. Native LoadVideo and SaveVideo complete the three-node workflow. Keep SaveVideo codec auto to avoid a second re-encode. Existing nodes and the API Platform repair engine are unchanged; no new dependencies.
+5
View File
@@ -0,0 +1,5 @@
# DOGMA 1.0.59
Fix **Correggi scatti** rejecting valid videos whose duration is not an exact number of milliseconds. Preserve source-clock precision in both MP4 movie and video track headers instead of using the default 1000 Hz movie clock. Applies to the shared NVIDIA and software repair encoder. Strict duration, frame timestamp, fps, color and audio checks are unchanged; no tolerance is loosened and no extra processing pass is added.
Validation: real API output-node execution, corrected-copy export and UI record; 457-frame 24 fps failure case; 24/25/60 and 24000/1001, 30000/1001, 60000/1001 timing cases through both encoders; fractional-fps audio preserved; a deliberate one-frame duration mismatch still rejected; repair disabled, error retention, cancellation and concurrent output naming. No paid generation requests were made. Existing API Platform and standalone workflows remain compatible.
+18
View File
@@ -213,3 +213,21 @@ Enable **Correggi scatti** in Video to save both the original and `_FIX.mp4`. Bo
The detector operates on small previews; RIFE reconstructs only selected frames at source resolution. Reliable pans with repeated jumps may additionally receive small camera translations, capped at 0.4% of width/height. This extends a thin edge strip by reflection instead of cropping or zooming. Camera refinement and interpolation share one encoding pass. Clean clips, poorly tracked shots, zooms and reversing camera paths are not stabilized. Frame count, timestamps, source bit depth and audio packet identity are checked before accepting the second file. A motion-based quality gate is an additional check, not a guarantee against every possible visual artifact. The method is independent of source fps and has no fixed clip-duration setting; processing time and memory grow with frame count and resolution. It does not impose 24 fps. CUDA and NVIDIA video encoding provide the fast path; CPU/software fallback is slower. First use includes model download and GPU initialization. No video is uploaded to another service. Generative deformations or newly invented content cannot be reliably restored by a cadence repair.
RIFE 4.26 code/weights: https://github.com/hzwer/Practical-RIFE (MIT; LICENSE_RIFE.txt). Verified weights are automatically cached under `models/DOGMA/rife`. Architecture derived from the official model archive, revision `01fdc7e97404120c243c3ea7b427046e5dc7643e`. DOGMA motion detection, timestamp planning and integration are separate from RIFE inference. No other ComfyUI interpolation extension is required.
## Standalone Seedance fix / 1.0.58
`Load Video → DOGMA / Fix video Seedance → Save Video` uses only the generated video. No original footage, API generation, credentials or credits are needed. The node reuses the unchanged 1.0.57 repair engine and its cached RIFE weights. Progress and a short result message are reported in ComfyUI. Clips without confidently detected stutter are returned unchanged; a rejected correction is explicitly reported as unchanged.
Use MP4 and codec **auto** in Save Video to preserve the corrected stream without another encoding pass. The supplied standalone workflow writes to `output/DOGMA/SeedanceFix/Seedance_FIX_*.mp4`. Duration, fps, frame timestamps, dimensions, color depth and audio are checked by the repair engine. The uploaded source is not overwritten. The fix runs outside the async event loop; Stop cancels processing and removes that attempt's partial files. Intermediate output and diagnostics live in ComfyUI's temp directory, so cached results can be saved again without repeating inference.
Existing API Platform, H3 and HDR workflows remain compatible. The same package supports Windows and the pod. No extra node pack is required.
## Correggi scatti: precise MP4 timing / 1.0.59
Fix the shared repair encoder used by API Platform's **Correggi scatti** switch and the standalone Seedance fix node. MP4's default 1000 Hz movie clock could truncate fractional-second clip ends and trigger "La durata del file corretto è cambiata", even with every frame and timestamp intact. For example, a 457-frame, 24 fps clip was rejected because the reported duration differed by eight video-clock ticks.
Both the NVIDIA and software encoder now use the source video's time base for the MP4 movie and video track clocks. The strict checks on frame count, timestamps, duration, fps, dimensions, color depth and copied audio remain in place. This changes only the container timing; motion analysis, interpolation, quality gates and correction settings are unchanged. It adds no interpolation or encoding pass.
When enabled, API Platform saves the generated original and a second locally processed copy in the existing project/scene workspace. Turning the switch off skips repair. Stop and real processing errors retain the original and report the outcome; an unsuccessful correction is never presented as repaired. Existing workflows and node IDs are compatible, with no new dependencies and the same code on Windows and the pod.
+12
View File
@@ -243,3 +243,15 @@ try:
del _APIV2, _APIV2_NAMES, _APIV2_ROUTES
except Exception as _apiv2_error:
print("[DOGMA API V2] Unavailable; previous DOGMA nodes preserved:", _apiv2_error)
# Standalone Seedance fix: same engine as API Platform, one VIDEO input.
try:
from .dogma_video_fix_node import NODE_CLASS_MAPPINGS as _FIX158, NODE_DISPLAY_NAME_MAPPINGS as _FIX158_NAMES
if set(_FIX158).intersection(NODE_CLASS_MAPPINGS):
raise RuntimeError("DOGMA Seedance fix: node ID collision")
NODE_CLASS_MAPPINGS.update(_FIX158)
NODE_DISPLAY_NAME_MAPPINGS.update(_FIX158_NAMES)
del _FIX158, _FIX158_NAMES
except Exception as _fix158_error:
print("[DOGMA Seedance fix] Unavailable; previous DOGMA nodes preserved:", _fix158_error)
+81
View File
@@ -0,0 +1,81 @@
"""Standalone VIDEO adapter for the same repair engine used by API Platform."""
import asyncio
import json
from pathlib import Path
import tempfile
import threading
from comfy_api.latest import io, ui, InputImpl, Types
class DOGMASeedanceVideoFix(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="DOGMASeedanceVideoFix",
display_name="DOGMA / Fix video Seedance",
category="DOGMA/Video",
description="Corregge gli scatti del solo video generato da Seedance. "
"Mantiene fps, durata, risoluzione e audio. Non richiede il video originale o API.",
inputs=[io.Video.Input("video", tooltip="Collega il video generato da Seedance.")],
outputs=[io.Video.Output("video_corretto")],
hidden=[io.Hidden.unique_id],
)
@classmethod
async def execute(cls, video):
cancelled=threading.Event()
worker=asyncio.create_task(asyncio.to_thread(cls._repair,video,cancelled,cls.hidden.unique_id))
try:
result,summary=await asyncio.shield(worker)
return io.NodeOutput(result,ui=ui.PreviewText(summary))
except asyncio.CancelledError:
cancelled.set()
try:await worker
except Exception:pass
raise
@staticmethod
def _repair(video,cancelled,node_id=None):
import folder_paths
import comfy.model_management as management
from comfy.utils import ProgressBar
from .dogma_video_repair import RepairCancelled,repair_video
progress=ProgressBar(100,node_id=node_id)
def check():
if cancelled.is_set():raise RepairCancelled("Correzione interrotta.")
management.throw_exception_if_processing_interrupted()
def update(stage,fraction):
check()
progress.update_absolute(round(max(0,min(1,fraction))*100))
check()
root=Path(folder_paths.get_temp_directory());root.mkdir(parents=True,exist_ok=True)
work=Path(tempfile.mkdtemp(prefix="dogma-seedance-fix-",dir=root))
source=work/'input.mp4';fixed=work/'corrected.mp4';report_file=work/'repair.json'
try:
# Native save remuxes uploaded MP4 streams. It also honors VIDEO trims
# if this node is reused in a larger graph, without tensorizing the clip.
video.save_to(str(source),format=Types.VideoContainer.MP4,codec=Types.VideoCodec.AUTO)
check()
report=repair_video(source,fixed,Path(folder_paths.models_dir)/'DOGMA'/'rife',cancel=check,progress=update)
check()
if report['status']=='repaired':
summary=f"Correzione completata · {report['fps']} fps · {report['interpolated_frames']} fotogrammi ricostruiti"
elif report['status']=='unchanged':
summary="Nessuno scatto riconosciuto: il video è rimasto invariato."
else:
summary="Correzione non applicata: il controllo non ha confermato un miglioramento. Video invariato."
report_file.write_text(json.dumps(report,ensure_ascii=False,indent=2),encoding='utf8')
source.unlink()
# The result stays in Comfy's temp directory for SaveVideo and caching.
return InputImpl.VideoFromFile(str(fixed)),summary
except BaseException:
for path in (source,fixed,report_file):path.unlink(missing_ok=True)
work.rmdir()
raise
NODE_CLASS_MAPPINGS={"DOGMASeedanceVideoFix":DOGMASeedanceVideoFix}
NODE_DISPLAY_NAME_MAPPINGS={"DOGMASeedanceVideoFix":"DOGMA / Fix video Seedance"}
+6 -1
View File
@@ -359,7 +359,12 @@ def _encoder(path, meta):
for codec,pixel,options in candidates:
container = None
try:
container = av.open(str(path),'w',format='mp4',options={'movflags':'+faststart'})
# MP4's default 1000 Hz movie clock truncates fractional-frame ends
# in edit lists (e.g. 457/24 s became 19.041015625 s). Use the source
# clock for both the movie and video track; keep strict verification.
clock=str(Fraction(meta['time_base']).denominator)
container = av.open(str(path),'w',format='mp4',options={
'movflags':'+faststart','movie_timescale':clock,'video_track_timescale':clock})
stream = container.add_stream(codec,rate=Fraction(meta['fps']))
stream.width=meta['width'];stream.height=meta['height'];stream.pix_fmt=pixel;stream.options=options
stream.time_base=Fraction(meta['time_base']);stream.codec_context.time_base=stream.time_base
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-dogma-nodes"
description = "Custom ComfyUI nodes for DOGMA AI video workflows."
version = "1.0.57"
version = "1.0.59"
license = { file = "LICENSE" }
dependencies = ["scipy>=1.10", "av>=18.0", "opencv-python>=4.8"]