@auscera/cleoedits 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -2
- package/cli.mjs +149 -0
- package/lib/dependencies.mjs +384 -0
- package/lib/run.mjs +114 -0
- package/lib/workspace.mjs +167 -0
- package/package.json +240 -3
- package/workspace/.agents/skills/cleoedits/SKILL.md +29 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/audiogram.json +41 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/facebook.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/linkedin.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/podcast.json +23 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/reels.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/shorts.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/tiktok.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/x.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube-shorts.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/LICENSE-SimpleIcons +30 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/logos.json +1 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Anton-Regular.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/ArchivoBlack-Regular.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/InstrumentSerif-Italic.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Inter.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/LICENSE-PermanentMarker.txt +202 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Montserrat.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Anton.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-ArchivoBlack.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-InstrumentSerif.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Inter.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Montserrat.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-PlayfairDisplay.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Poppins.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-SpaceMono.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PermanentMarker-Regular.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay-Italic.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Black.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Bold.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-ExtraBold.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/SpaceMono-Bold.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-MediaPipe +218 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-YuNet +21 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/NOTICE.md +4 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/selfie_segmenter.tflite +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/yunet.onnx +0 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/LICENSE +21 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/audio-app-ui/STYLE.md +65 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/STYLE.md +53 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/index.html +328 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/STYLE.md +65 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/index.html +575 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/design-app-ui/STYLE.md +68 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editor-ui/STYLE.md +73 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/STYLE.md +54 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/index.html +189 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/STYLE.md +64 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/index.html +620 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/STYLE.md +55 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/index.html +238 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/STYLE.md +66 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/index.html +602 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/STYLE.md +66 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/index.html +777 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/STYLE.md +56 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/index.html +186 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/motion-app-ui/STYLE.md +68 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/STYLE.md +56 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/index.html +244 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/STYLE.md +67 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/index.html +663 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/STYLE.md +59 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/index.html +395 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/STYLE.md +52 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/index.html +194 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/STYLE.md +58 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/index.html +242 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/STYLE.md +53 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/index.html +138 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/STYLE.md +63 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/index.html +599 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/STYLE.md +65 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/index.html +1297 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/STYLE.md +69 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/index.html +674 -0
- package/workspace/.agents/skills/cleoedits/references/audio-clearervoice-elevenlabs.md +11 -0
- package/workspace/.agents/skills/cleoedits/references/ffmpeg-and-reels.md +15 -0
- package/workspace/.agents/skills/cleoedits/references/hyperframes-workflows.md +13 -0
- package/workspace/.agents/skills/cleoedits/references/kdenlive-cli-and-mcp.md +12 -0
- package/workspace/.agents/skills/cleoedits/references/motion-design-pipeline.md +7 -0
- package/workspace/.agents/skills/cleoedits/references/motion-taste-emil.md +5 -0
- package/workspace/.agents/skills/cleoedits/references/playwright-demo-capture.md +9 -0
- package/workspace/.agents/skills/cleoedits/references/remotion-workflows.md +13 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/LICENSE +21 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_ass_overlay.py +399 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/__init__.py +235 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/alpha.py +560 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/asr.py +1237 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/color.py +540 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/decision.py +2452 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/drawtext.py +290 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emit.py +1309 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emoji.py +518 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/fonts.py +875 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing.py +263 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing_edit.py +432 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/probe.py +1613 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/runner.py +3994 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/text.py +73 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/timeline.py +721 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/wrap.py +981 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_contract.py +2454 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_platforms.py +258 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.html +754 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.py +258 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_smartcut.py +450 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/audio.py +867 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/background.py +136 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/batch.py +1409 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/broll.py +282 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/caption.py +2207 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/check.py +815 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/color.py +695 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/crop.py +91 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cropdetect.py +214 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cut.py +2076 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/deinterlace.py +90 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/denoise.py +94 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/export.py +1033 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/fit.py +729 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/freeze.py +197 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/graphics.py +920 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/grid.py +235 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/insert.py +142 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/join.py +1083 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/look.py +475 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loop.py +395 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loudness.py +397 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/metadata.py +416 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/multicam.py +414 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/overlay.py +766 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/pad.py +121 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/probe.py +145 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/proxy.py +93 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/redact.py +162 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/render.py +2424 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/report.py +354 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/reverse.py +114 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/scenes.py +439 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sequence.py +285 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/silence.py +945 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/speedramp.py +193 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sphere.py +137 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/stabilize.py +141 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/straighten.py +120 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sync.py +500 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/verify.py +411 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/waveform.py +502 -0
- package/workspace/.agents/skills/cleoedits/scripts/kdenlive_builder.py +284 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-claude-motion +21 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-motion-design +21 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/_media.py +43 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/pacing_check.py +90 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/storyboard.py +77 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/LICENSE +26 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/fx.py +2717 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/logos.py +194 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/sfx.py +105 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/trim.py +99 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/words.py +60 -0
- package/workspace/.claude/commands/blender-3d.md +12 -0
- package/workspace/.claude/commands/business-short-form-reels.md +12 -0
- package/workspace/.claude/commands/color-grade.md +12 -0
- package/workspace/.claude/commands/cutout-grid-reel.md +12 -0
- package/workspace/.claude/commands/depth-ui-reel.md +12 -0
- package/workspace/.claude/commands/explainer-panel-reel.md +12 -0
- package/workspace/.claude/commands/freeze-frame.md +12 -0
- package/workspace/.claude/commands/glass-graph.md +12 -0
- package/workspace/.claude/commands/over-the-shoulder.md +12 -0
- package/workspace/.claude/commands/personal-short-form-reels.md +12 -0
- package/workspace/.claude/commands/ranking-format.md +12 -0
- package/workspace/.claude/commands/relight.md +12 -0
- package/workspace/.claude/commands/reverse-engineer.md +12 -0
- package/workspace/.claude/commands/text-behind.md +12 -0
- package/workspace/.claude/commands/tier-list.md +12 -0
- package/workspace/.claude-plugin/plugin.json +8 -0
- package/workspace/.npmignore +15 -0
- package/workspace/AGENTS.md +30 -0
- package/workspace/README.md +63 -0
- package/workspace/assets/fonts/TikTokSans-OFL.txt +93 -0
- package/workspace/assets/fonts/TikTokSans-Variable.ttf +0 -0
- package/workspace/assets/luts/clean_warm.cube +4917 -0
- package/workspace/assets/luts/golden_hour.cube +4917 -0
- package/workspace/assets/luts/moody_dark.cube +4917 -0
- package/workspace/assets/luts/teal_orange.cube +4917 -0
- package/workspace/assets/sfx/NOTICE.txt +1 -0
- package/workspace/assets/sfx/click.wav +0 -0
- package/workspace/assets/sfx/pop.wav +0 -0
- package/workspace/assets/sfx/riser.wav +0 -0
- package/workspace/assets/sfx/whoosh.wav +0 -0
- package/workspace/generators/hyperframes/index.html +39 -0
- package/workspace/generators/hyperframes/package.json +15 -0
- package/workspace/generators/hyperframes/pnpm-lock.yaml +1181 -0
- package/workspace/generators/hyperframes/pnpm-workspace.yaml +10 -0
- package/workspace/generators/remotion/eslint.config.mjs +3 -0
- package/workspace/generators/remotion/package.json +36 -0
- package/workspace/generators/remotion/pnpm-lock.yaml +4179 -0
- package/workspace/generators/remotion/pnpm-workspace.yaml +10 -0
- package/workspace/generators/remotion/remotion.config.ts +13 -0
- package/workspace/generators/remotion/src/Root.tsx +52 -0
- package/workspace/generators/remotion/src/index.css +1 -0
- package/workspace/generators/remotion/src/index.ts +4 -0
- package/workspace/generators/remotion/tsconfig.json +15 -0
- package/workspace/pipeline/scripts/_codec.py +28 -0
- package/workspace/pipeline/scripts/ai_media_api.py +109 -0
- package/workspace/pipeline/scripts/blender_render.py +166 -0
- package/workspace/pipeline/scripts/composite.py +49 -0
- package/workspace/pipeline/scripts/melt.sh +68 -0
- package/workspace/pipeline/scripts/normalize_audio.py +39 -0
- package/workspace/pipeline/scripts/person_matte.py +216 -0
- package/workspace/pipeline/scripts/record_demo.py +69 -0
- package/workspace/pipeline/scripts/whisper_cut.py +98 -0
- package/workspace-manifest.json +908 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Real-footage verification kit: run the whole toolchain against your own
|
|
3
|
+
files (phone HDR, GoPro, OBS screen captures, Log footage, Zoom recordings)
|
|
4
|
+
and get a pass/fail table. Synthetic test media never shows what a real
|
|
5
|
+
container does; this does.
|
|
6
|
+
|
|
7
|
+
Every file gets: probe, lossless cut, accurate cut, fit (9:16 pad), caption
|
|
8
|
+
burn, overlay text, loudness measurement, silence listing, export (x preset),
|
|
9
|
+
look (contact sheet), plus color --to-sdr when the file is HDR and
|
|
10
|
+
audio --downmix when it has more than 2 channels.
|
|
11
|
+
|
|
12
|
+
Examples:
|
|
13
|
+
python3 verify.py ~/Footage/*.MOV ~/Footage/*.mp4
|
|
14
|
+
python3 verify.py fixtures/ --quick --report verify.md
|
|
15
|
+
python3 verify.py clip.mov --keep --out ./verify_out
|
|
16
|
+
"""
|
|
17
|
+
import argparse
|
|
18
|
+
import contextlib
|
|
19
|
+
import io
|
|
20
|
+
import json
|
|
21
|
+
import os
|
|
22
|
+
import subprocess
|
|
23
|
+
import sys
|
|
24
|
+
import tempfile
|
|
25
|
+
import time
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
28
|
+
|
|
29
|
+
from _common import STATE, add_common, apply_common, die, emit, guard_sidecar, info, probe, refuse_output_is_input, MEDIA_EXT as _MEDIA_EXT
|
|
30
|
+
from _common.runner import absent_word, file_arg, _stop_child, _unwatch, _watch
|
|
31
|
+
|
|
32
|
+
HERE = Path(__file__).resolve().parent
|
|
33
|
+
# _common's one list less the stills, as batch.py walks a folder: verify kept a list of its own,
|
|
34
|
+
# and a folder walk skipped .ts, .3gp, .wmv, .gif, .ogg, .opus, .aif/.aiff, .caf and .wma (#467 A218)
|
|
35
|
+
MEDIA_EXT = {e for e in _MEDIA_EXT if e not in (".png", ".jpg", ".jpeg", ".webp")}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def unique_stems(files: List[Path]) -> Dict[Path, str]:
|
|
39
|
+
"""Every file's outputs share one flat --out directory (stem = outdir / f.stem), so two files
|
|
40
|
+
with the same basename from different folders -- entirely normal for real footage collected
|
|
41
|
+
from multiple cameras/SD cards, e.g. two "clip.mp4"s in separate campaign folders -- used to
|
|
42
|
+
resolve to the identical output prefix. Each file's own steps still ran correctly in isolation,
|
|
43
|
+
but with --keep the second file's outputs silently overwrote the first file's on disk, and the
|
|
44
|
+
report showed PASS for both without ever flagging the collision (same bug class already fixed
|
|
45
|
+
in batch.py). Disambiguate every colliding stem with a stable per-collision index instead.
|
|
46
|
+
|
|
47
|
+
A stem is compared case-folded (clip.mp4 and Clip.MOV share one name on a case-insensitive
|
|
48
|
+
disk), and an indexed name skips any stem already taken, a file's own included: through 3.8.8
|
|
49
|
+
two clip.mp4 and a clip_1.mp4 gave "clip_1" twice (audit A121)."""
|
|
50
|
+
counts: Dict[str, int] = {}
|
|
51
|
+
for f in files:
|
|
52
|
+
counts[f.stem.casefold()] = counts.get(f.stem.casefold(), 0) + 1
|
|
53
|
+
taken = {f.stem.casefold() for f in files if counts[f.stem.casefold()] == 1}
|
|
54
|
+
seen: Dict[str, int] = {}
|
|
55
|
+
stems: Dict[Path, str] = {}
|
|
56
|
+
for f in files:
|
|
57
|
+
key = f.stem.casefold()
|
|
58
|
+
if counts[key] == 1:
|
|
59
|
+
stems[f] = f.stem
|
|
60
|
+
continue
|
|
61
|
+
n = seen.get(key, 0)
|
|
62
|
+
while True:
|
|
63
|
+
n += 1
|
|
64
|
+
name = f"{f.stem}_{n}"
|
|
65
|
+
if name.casefold() not in taken:
|
|
66
|
+
break
|
|
67
|
+
seen[key] = n
|
|
68
|
+
taken.add(name.casefold())
|
|
69
|
+
stems[f] = name
|
|
70
|
+
return stems
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def collect(paths: List[str]) -> List[Path]:
|
|
74
|
+
files: List[Path] = []
|
|
75
|
+
for p in paths:
|
|
76
|
+
pp = Path(p)
|
|
77
|
+
# os.path, not Path.is_dir(): that one raises on a path the user may not look at (#558)
|
|
78
|
+
if os.path.isdir(p):
|
|
79
|
+
files += sorted(x for x in pp.rglob("*") if x.suffix.lower() in MEDIA_EXT and x.is_file())
|
|
80
|
+
elif os.path.isfile(p):
|
|
81
|
+
files.append(pp)
|
|
82
|
+
else:
|
|
83
|
+
die(f"{absent_word(p)}: {p}")
|
|
84
|
+
if not files:
|
|
85
|
+
die("no media files found")
|
|
86
|
+
return files
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _cell(message: str) -> str:
|
|
90
|
+
"""A failure message as one Markdown table cell: one line, no pipes, at most 200 characters."""
|
|
91
|
+
return " / ".join(line.strip() for line in str(message).splitlines() if line.strip()).replace("|", "/")[:200]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _probe_capturing(path: str) -> "Tuple[Optional[Dict[str, Any]], Dict[str, Any]]":
|
|
95
|
+
"""probe() in this process, with its failure kept: (the probe, {}) or (None, the failure's
|
|
96
|
+
kind/reason/message). probe() dies on an unreadable file; its failure document is read back
|
|
97
|
+
instead of a fixed string standing in for it (one JSON document per run: it is not printed)."""
|
|
98
|
+
was_json, STATE.json = STATE.json, True
|
|
99
|
+
out, err = io.StringIO(), io.StringIO()
|
|
100
|
+
try:
|
|
101
|
+
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
|
|
102
|
+
return probe(path), {}
|
|
103
|
+
except SystemExit as exc:
|
|
104
|
+
try:
|
|
105
|
+
doc = json.loads(out.getvalue())
|
|
106
|
+
except ValueError:
|
|
107
|
+
doc = {}
|
|
108
|
+
e = doc.get("error") if isinstance(doc.get("error"), dict) else {}
|
|
109
|
+
failure = {k: e[k] for k in ("kind", "reason", "message") if e.get(k)}
|
|
110
|
+
failure.setdefault("message", (err.getvalue().strip().splitlines() or [f"probe exited {exc.code}"])[-1])
|
|
111
|
+
return None, failure
|
|
112
|
+
finally:
|
|
113
|
+
STATE.json = was_json
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# The shared flags given to verify.py that every step receives as well (set in main())
|
|
117
|
+
FORWARD: Dict[str, bool] = {"overwrite": False, "fast": False}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _forwarded(argv: List[str]) -> List[str]:
|
|
121
|
+
"""--overwrite and --fast as the caller gave them to verify.py: through 3.8.8 neither reached
|
|
122
|
+
a step, so a rerun into the same --out failed every step on its own earlier output (audit
|
|
123
|
+
A119). The steps' --timeout is verify's own per-step limit (step()'s `timeout`)."""
|
|
124
|
+
out = ["--overwrite"] if FORWARD["overwrite"] else []
|
|
125
|
+
if FORWARD["fast"] and "--fast" not in argv:
|
|
126
|
+
out.append("--fast")
|
|
127
|
+
return out
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def step(name: str, argv: List[str], timeout: float) -> Dict:
|
|
131
|
+
"""Run one step and keep what its tool said: `ok` (it completed), and on a failure the tool's
|
|
132
|
+
own `kind`, `reason` and `message` (its --json failure document), `error` being that message
|
|
133
|
+
for the table. A completed step also carries the tool's `verified`."""
|
|
134
|
+
t0 = time.time()
|
|
135
|
+
if argv[0] == "__check_hdr__":
|
|
136
|
+
meta, failure = _probe_capturing(argv[1])
|
|
137
|
+
if meta is None:
|
|
138
|
+
return dict({"step": name, "ok": False, "seconds": round(time.time() - t0, 1), "error": _cell(failure.get("message", ""))}, **failure)
|
|
139
|
+
v = meta.get("video") or {}
|
|
140
|
+
ok = bool(v.get("bt2020_or_hdr")) and v.get("bit_depth", 8) >= 10
|
|
141
|
+
r: Dict[str, Any] = {"step": name, "ok": ok, "seconds": round(time.time() - t0, 1),
|
|
142
|
+
"error": "" if ok else f"re-encode lost HDR: {v.get('color_transfer')}/{v.get('pix_fmt')}"}
|
|
143
|
+
if not ok:
|
|
144
|
+
r.update(kind="verification", reason="hdr_lost", message=r["error"])
|
|
145
|
+
return r
|
|
146
|
+
# argv[1] is the step's input: one named -take.mp4 is given as ./-take.mp4, or the step's
|
|
147
|
+
# parser reads it as an option (collect()'s Path drops a ./ the caller wrote, #558)
|
|
148
|
+
child = subprocess.Popen([sys.executable, str(HERE / argv[0]), file_arg(argv[1])] + argv[2:] + _forwarded(argv) + ["--json"], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
|
|
149
|
+
stderr=subprocess.PIPE, text=True, encoding="utf-8", errors="replace")
|
|
150
|
+
# watched like run_tool()'s child (review of #530): a SIGTERM or Ctrl-C to verify.py stops the
|
|
151
|
+
# step through stop_children() -- its own handler removes its partial output and lock --
|
|
152
|
+
# instead of leaving it running and writing after verify.py has exited
|
|
153
|
+
_watch(child, [])
|
|
154
|
+
try:
|
|
155
|
+
out, err = child.communicate(timeout=timeout or None)
|
|
156
|
+
proc = subprocess.CompletedProcess(child.args, child.returncode, out, err)
|
|
157
|
+
except subprocess.TimeoutExpired:
|
|
158
|
+
# stopped as run_tool() stops a sibling script past its ceiling (#465 A183's sweep): the
|
|
159
|
+
# SIGKILL subprocess.run() sent left the step's partial output and output lock in --out
|
|
160
|
+
_stop_child(child)
|
|
161
|
+
msg = f"timeout after {timeout:.0f}s"
|
|
162
|
+
return {"step": name, "ok": False, "seconds": round(time.time() - t0, 1), "error": msg,
|
|
163
|
+
"kind": "timeout", "reason": "step_timeout", "message": msg}
|
|
164
|
+
finally:
|
|
165
|
+
_unwatch(child)
|
|
166
|
+
try:
|
|
167
|
+
doc = json.loads(proc.stdout)
|
|
168
|
+
except ValueError:
|
|
169
|
+
doc = None
|
|
170
|
+
doc = doc if isinstance(doc, dict) else {}
|
|
171
|
+
ok = proc.returncode == 0
|
|
172
|
+
r = {"step": name, "ok": ok, "seconds": round(time.time() - t0, 1), "error": ""}
|
|
173
|
+
if ok:
|
|
174
|
+
if "verified" in doc:
|
|
175
|
+
r["verified"] = doc["verified"]
|
|
176
|
+
return r
|
|
177
|
+
e = doc.get("error") if isinstance(doc.get("error"), dict) else {}
|
|
178
|
+
r["message"] = str(e.get("message") or (proc.stderr.strip().splitlines() or [f"exit {proc.returncode}"])[-1])
|
|
179
|
+
r["error"] = _cell(r["message"])
|
|
180
|
+
for k in ("kind", "reason", "details"):
|
|
181
|
+
if e.get(k) is not None:
|
|
182
|
+
r[k] = e[k]
|
|
183
|
+
if not e:
|
|
184
|
+
r["reason"] = "step_output_unparsed"
|
|
185
|
+
r["exit_code"] = proc.returncode
|
|
186
|
+
return r
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def main() -> int:
|
|
190
|
+
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
191
|
+
ap.add_argument("paths", nargs="+", help="media files and/or folders")
|
|
192
|
+
ap.add_argument("--out", help="directory for outputs (default: temp dir, deleted unless --keep)")
|
|
193
|
+
ap.add_argument("--keep", action="store_true", help="keep the outputs (without --out: in a new folder, named as out_dir and on stderr)")
|
|
194
|
+
ap.add_argument("--quick", action="store_true", help="probe, copy cut, fit, caption, export only")
|
|
195
|
+
ap.add_argument("--duration", "--seconds", dest="seconds", type=float, default=6.0, help="length of the test cut taken from each file (default 6)")
|
|
196
|
+
ap.add_argument("--timeout", type=float, default=600.0, help="per-step timeout in seconds (default 600; 0 = no limit, as everywhere else)")
|
|
197
|
+
ap.add_argument("--report", help="write a Markdown report here")
|
|
198
|
+
ap.add_argument("--profile", help="pacing-profile@1 JSON path or sns-short, youtube-talk, podcast-natural")
|
|
199
|
+
ap.add_argument("--protect-ranges", help="JSON intervals in source milliseconds to preserve")
|
|
200
|
+
ap.add_argument("--source", help="original media for the independent pacing gate")
|
|
201
|
+
add_common(ap)
|
|
202
|
+
args = ap.parse_args()
|
|
203
|
+
apply_common(args)
|
|
204
|
+
if args.profile or args.protect_ranges or args.source:
|
|
205
|
+
from _common.pacing_edit import cli
|
|
206
|
+
return cli(args, checking=True)
|
|
207
|
+
if STATE.plan:
|
|
208
|
+
die("verify.py does not support --plan: its steps run for real (it ignores --dry-run too)")
|
|
209
|
+
ignored_dry_run = STATE.dry_run
|
|
210
|
+
if ignored_dry_run:
|
|
211
|
+
# A240: the flag is accepted and ignored (docs/design-decisions.md "Dry run"); the steps
|
|
212
|
+
# run and write, so the document says dry_run: false and a note says the flag was ignored
|
|
213
|
+
STATE.dry_run = False
|
|
214
|
+
info("--dry-run is ignored by verify.py: its steps run and write their outputs")
|
|
215
|
+
|
|
216
|
+
if args.seconds <= 0:
|
|
217
|
+
# A190: every step was handed a cut of no length and failed, which read as the tools'
|
|
218
|
+
# fault ("9 of 11 verification steps failed") rather than the flag's
|
|
219
|
+
die(f"--seconds must be more than 0 (the length of the test cut), got {args.seconds:g}")
|
|
220
|
+
files = collect(args.paths)
|
|
221
|
+
FORWARD.update(overwrite=STATE.overwrite, fast=STATE.fast)
|
|
222
|
+
tmp = None
|
|
223
|
+
started = {"step": False}
|
|
224
|
+
if args.out:
|
|
225
|
+
# made first, so a --report inside a new --out folder passes the guard below (#413 review)
|
|
226
|
+
outdir = Path(args.out)
|
|
227
|
+
made = [d for d in (outdir, *outdir.parents) if not d.exists()]
|
|
228
|
+
outdir.mkdir(parents=True, exist_ok=True)
|
|
229
|
+
if made:
|
|
230
|
+
import atexit
|
|
231
|
+
|
|
232
|
+
def _remove_unused_dirs() -> None:
|
|
233
|
+
# a run refused before its first step (a --report guard) leaves no empty --out
|
|
234
|
+
# folder behind, as batch.py leaves no out/ (#465 A187's sibling); once a step has
|
|
235
|
+
# run the folder is the caller's, empty or not
|
|
236
|
+
if started["step"]:
|
|
237
|
+
return
|
|
238
|
+
for d in made: # deepest first
|
|
239
|
+
try:
|
|
240
|
+
d.rmdir()
|
|
241
|
+
except OSError:
|
|
242
|
+
pass
|
|
243
|
+
atexit.register(_remove_unused_dirs)
|
|
244
|
+
if args.report:
|
|
245
|
+
# a file this run writes itself (#408): not one of the media it verifies (a folder's
|
|
246
|
+
# files included), nor an existing file without --overwrite
|
|
247
|
+
guard_sidecar(args.report, *args.paths, *map(str, files))
|
|
248
|
+
if not args.out and args.keep:
|
|
249
|
+
# --keep without --out: a folder of its own that outlives the run, named in the document
|
|
250
|
+
# (`out_dir`) and on stderr; through 3.8.8 it was the temporary directory, deleted at exit
|
|
251
|
+
# whatever --keep said, and never named (audit A120)
|
|
252
|
+
outdir = Path(tempfile.mkdtemp(prefix="ffskill_verify_"))
|
|
253
|
+
elif not args.out:
|
|
254
|
+
tmp = tempfile.TemporaryDirectory(prefix="ffskill_verify_")
|
|
255
|
+
outdir = Path(tmp.name)
|
|
256
|
+
kept_dir = None if tmp else str(outdir)
|
|
257
|
+
|
|
258
|
+
stem_for = unique_stems(files)
|
|
259
|
+
# every file's plan is made before any step runs, so the names all of them will write are
|
|
260
|
+
# checked against every input first (below)
|
|
261
|
+
jobs: List[Tuple[Path, Dict, List[Tuple[str, List[str]]], Optional[Path]]] = []
|
|
262
|
+
for f in files:
|
|
263
|
+
entry: Dict = {"file": str(f), "steps": [], "skipped": []}
|
|
264
|
+
meta, failure = _probe_capturing(str(f))
|
|
265
|
+
if meta is None:
|
|
266
|
+
entry["steps"].append(dict({"step": "probe", "ok": False, "seconds": 0, "error": _cell(failure.get("message", ""))}, **failure))
|
|
267
|
+
entry["skipped"].append({"step": "*", "reason": "input_unreadable", "message": "no other step runs on a file probe cannot read"})
|
|
268
|
+
jobs.append((f, entry, [], None))
|
|
269
|
+
continue
|
|
270
|
+
entry["probe"] = {k: meta.get(k) for k in ("duration", "format")}
|
|
271
|
+
entry["probe"]["video"] = {k: (meta.get("video") or {}).get(k) for k in ("codec", "width", "height", "fps", "pix_fmt", "hdr_format", "rotation", "variable_frame_rate_suspected")}
|
|
272
|
+
entry["probe"]["audio"] = {k: (meta.get("audio") or {}).get(k) for k in ("codec", "channels", "sample_rate")}
|
|
273
|
+
entry["steps"].append({"step": "probe", "ok": True, "seconds": 0, "error": ""})
|
|
274
|
+
dur = meta.get("duration") or 0.0
|
|
275
|
+
has_v, has_a = bool(meta.get("video")), bool(meta.get("audio"))
|
|
276
|
+
stem = outdir / stem_for[f]
|
|
277
|
+
cut = f"{stem}_cut.mp4"
|
|
278
|
+
seg_end = min(dur, args.seconds) if dur else args.seconds
|
|
279
|
+
fast = ["--fast"]
|
|
280
|
+
plan: List[Tuple[str, List[str]]] = []
|
|
281
|
+
cues: Optional[Path] = None
|
|
282
|
+
skipped: List[Dict[str, str]] = entry["skipped"]
|
|
283
|
+
|
|
284
|
+
def skip(step_name: str, reason: str, message: str) -> None:
|
|
285
|
+
skipped.append({"step": step_name, "reason": reason, "message": message})
|
|
286
|
+
plan.append(("cut copy", ["cut.py", str(f), "--start", "0", "--end", f"{seg_end:.2f}", "-o", cut]))
|
|
287
|
+
if has_v:
|
|
288
|
+
plan.append(("cut accurate", ["cut.py", str(f), "--start", "0", "--end", f"{seg_end:.2f}", "--accurate", "-o", f"{stem}_acc.mp4"] + fast))
|
|
289
|
+
plan.append(("fit 9:16", ["fit.py", cut, "--aspect", "9:16", "--width", "720", "-o", f"{stem}_fit.mp4"] + fast))
|
|
290
|
+
cues = outdir / f"{stem_for[f]}_cues.txt"
|
|
291
|
+
plan.append(("caption", ["caption.py", cut, "--text", str(cues), "--animate", "pop", "--karaoke", "-o", f"{stem}_cap.mp4"] + fast))
|
|
292
|
+
if not args.quick:
|
|
293
|
+
plan.append(("overlay text", ["overlay.py", cut, "--text", "verify", "--position", "top-left", "-o", f"{stem}_ovl.mp4"] + fast))
|
|
294
|
+
plan.append(("look sheet", ["look.py", cut, "-o", f"{stem}_sheet.png"]))
|
|
295
|
+
if (meta.get("video") or {}).get("bt2020_or_hdr"):
|
|
296
|
+
plan.append(("color to-sdr", ["color.py", f"{stem}_acc.mp4", "--to-sdr", "-o", f"{stem}_sdr.mp4"] + fast))
|
|
297
|
+
plan.append(("hdr preserved", ["__check_hdr__", f"{stem}_acc.mp4"]))
|
|
298
|
+
plan.append(("probe analyze", ["probe.py", cut, "--analyze"]))
|
|
299
|
+
else:
|
|
300
|
+
for n in ("overlay text", "look sheet", "color to-sdr", "hdr preserved", "probe analyze"):
|
|
301
|
+
skip(n, "quick", "--quick runs probe, copy cut, fit, caption and export only")
|
|
302
|
+
if not args.quick and not (meta.get("video") or {}).get("bt2020_or_hdr"):
|
|
303
|
+
for n in ("color to-sdr", "hdr preserved"):
|
|
304
|
+
skip(n, "not_hdr", "the file is not HDR")
|
|
305
|
+
plan.append(("export x", ["export.py", cut, "--preset", "x", "-o", f"{stem}_x.mp4"]))
|
|
306
|
+
else:
|
|
307
|
+
for n in ("cut accurate", "fit 9:16", "caption", "overlay text", "look sheet", "color to-sdr", "hdr preserved",
|
|
308
|
+
"probe analyze", "export x"):
|
|
309
|
+
skip(n, "no_video", "the file has no video stream")
|
|
310
|
+
if has_a and not args.quick:
|
|
311
|
+
plan.append(("loudness measure", ["loudness.py", str(f), "--measure-only"]))
|
|
312
|
+
plan.append(("silence list", ["silence.py", cut, "--list"]))
|
|
313
|
+
if (meta.get("audio") or {}).get("channels", 0) > 2:
|
|
314
|
+
plan.append(("audio downmix", ["audio.py", cut, "--downmix", "-o", f"{stem}_st.mp4"]))
|
|
315
|
+
else:
|
|
316
|
+
skip("audio downmix", "not_multichannel", "the audio has 2 channels or fewer")
|
|
317
|
+
elif not has_a:
|
|
318
|
+
for n in ("loudness measure", "silence list", "audio downmix"):
|
|
319
|
+
skip(n, "no_audio", "the file has no audio stream")
|
|
320
|
+
else:
|
|
321
|
+
for n in ("loudness measure", "silence list", "audio downmix"):
|
|
322
|
+
skip(n, "quick", "--quick runs probe, copy cut, fit, caption and export only")
|
|
323
|
+
jobs.append((f, entry, plan, cues))
|
|
324
|
+
|
|
325
|
+
# A name verify generates can be another input's (clip.mp4's cut is clip_cut.mp4, which can be
|
|
326
|
+
# a file of the same folder): each step checks its output against its own input only, so with
|
|
327
|
+
# --overwrite that input was replaced and its own steps then read the replacement. Every name
|
|
328
|
+
# the run will write -- step outputs, caption's sidecars, the cue file -- against every input,
|
|
329
|
+
# through a link or another case of the name included, before the first is written.
|
|
330
|
+
every_input = [str(f) for f in files]
|
|
331
|
+
every_written: List[str] = []
|
|
332
|
+
for f, _entry, plan, cues in jobs:
|
|
333
|
+
written = [("cue file", str(cues))] if cues else []
|
|
334
|
+
for name, argv in plan:
|
|
335
|
+
if "-o" in argv:
|
|
336
|
+
out = argv[argv.index("-o") + 1]
|
|
337
|
+
written.append((name, out))
|
|
338
|
+
if argv[0] == "caption.py":
|
|
339
|
+
written += [(name, str(Path(out).with_suffix(ext))) for ext in (".srt", ".ass")]
|
|
340
|
+
for name, out in written:
|
|
341
|
+
refuse_output_is_input(out, *every_input, why=f"it is where verify writes the {name!r} step's output for {str(f)!r}")
|
|
342
|
+
every_written += [out for _name, out in written]
|
|
343
|
+
if args.report:
|
|
344
|
+
# the report is written last, over whatever is at its path: one of the names the steps write
|
|
345
|
+
# (`--report OUT/clip_cut.mp4`) was replaced by the Markdown after the steps had read it (#522)
|
|
346
|
+
guard_sidecar(args.report, siblings=every_written)
|
|
347
|
+
|
|
348
|
+
results = []
|
|
349
|
+
started["step"] = True
|
|
350
|
+
for f, entry, plan, cues in jobs:
|
|
351
|
+
info(f"=== {f}")
|
|
352
|
+
# the cue file is verify's own write: an existing one is replaced only with --overwrite, as
|
|
353
|
+
# every step's output is. Without it the caption step fails on it, as a step fails on its
|
|
354
|
+
# existing output, and the file is left as it was (#522; it was replaced unasked)
|
|
355
|
+
# A link or a folder at its name is never written through, --overwrite or not.
|
|
356
|
+
odd = bool(cues and os.path.lexists(cues) and (os.path.islink(cues) or not os.path.isfile(cues)))
|
|
357
|
+
cues_taken = odd or bool(cues and os.path.lexists(cues) and not FORWARD["overwrite"])
|
|
358
|
+
if cues and not cues_taken:
|
|
359
|
+
cues.write_text("0:00-0:02 Verification caption\n0:02-0:04 Second | line\n", encoding="utf-8")
|
|
360
|
+
for name, argv in plan:
|
|
361
|
+
if cues_taken and argv[0] == "caption.py":
|
|
362
|
+
msg = (f"refusing to write the cue file the caption step reads through {str(cues)!r}: it is a link "
|
|
363
|
+
"or not a regular file" if odd else
|
|
364
|
+
f"refusing to overwrite the existing cue file {str(cues)!r} the caption step reads: pass --overwrite to replace it")
|
|
365
|
+
r = {"step": name, "ok": False, "seconds": 0.0, "error": _cell(msg), "kind": "input",
|
|
366
|
+
"reason": "output_exists", "message": msg}
|
|
367
|
+
else:
|
|
368
|
+
r = step(name, argv, args.timeout)
|
|
369
|
+
entry["steps"].append(r)
|
|
370
|
+
info(f" {'PASS' if r['ok'] else 'FAIL'} {name:16s} {r['seconds']:6.1f}s {r['error']}")
|
|
371
|
+
results.append(entry)
|
|
372
|
+
|
|
373
|
+
total = sum(len(e["steps"]) for e in results)
|
|
374
|
+
failed = sum(1 for e in results for s in e["steps"] if not s["ok"])
|
|
375
|
+
lines = ["# ffmpeg-skill verification", "", f"{len(files)} files, {total} steps, {failed} failed", ""]
|
|
376
|
+
for e in results:
|
|
377
|
+
p = e.get("probe", {})
|
|
378
|
+
v, a = p.get("video", {}), p.get("audio", {})
|
|
379
|
+
lines.append(f"## {e['file']}")
|
|
380
|
+
lines.append(f"{p.get('duration')}s, {v.get('codec')} {v.get('width')}x{v.get('height')} @ {v.get('fps')} {v.get('pix_fmt')}"
|
|
381
|
+
+ (f" [{v.get('hdr_format')}]" if v.get("hdr_format") else "") + (" [VFR?]" if v.get("variable_frame_rate_suspected") else "")
|
|
382
|
+
+ (f" rot {v.get('rotation')}" if v.get("rotation") else "") + f", audio {a.get('codec')} {a.get('channels')}ch")
|
|
383
|
+
lines.append("")
|
|
384
|
+
lines.append("| step | result | time | error |")
|
|
385
|
+
lines.append("|---|---|---|---|")
|
|
386
|
+
for s in e["steps"]:
|
|
387
|
+
lines.append(f"| {s['step']} | {'PASS' if s['ok'] else 'FAIL'} | {s['seconds']}s | {s['error']} |")
|
|
388
|
+
for s in e.get("skipped") or []:
|
|
389
|
+
lines.append(f"| {s['step']} | SKIP | - | {s['message']} |")
|
|
390
|
+
lines.append("")
|
|
391
|
+
report = "\n".join(lines)
|
|
392
|
+
if args.report:
|
|
393
|
+
Path(args.report).write_text(report, encoding="utf-8")
|
|
394
|
+
info(f"wrote {args.report}")
|
|
395
|
+
if not args.json:
|
|
396
|
+
print(report)
|
|
397
|
+
if tmp:
|
|
398
|
+
tmp.cleanup()
|
|
399
|
+
if kept_dir:
|
|
400
|
+
info(f"step outputs kept in {kept_dir}")
|
|
401
|
+
notes = (["--dry-run is ignored by verify.py: its steps ran and wrote their outputs"] if ignored_dry_run else [])
|
|
402
|
+
if failed:
|
|
403
|
+
die(f"{failed} of {total} verification steps failed", kind="verification", output=None, dry_run=STATE.dry_run,
|
|
404
|
+
report=args.report, files=results, failed=failed, total=total, out_dir=kept_dir, **({"notes": notes} if notes else {}))
|
|
405
|
+
if args.json:
|
|
406
|
+
emit(None, report=args.report, files=results, failed=failed, total=total, out_dir=kept_dir, **({"notes": notes} if notes else {}))
|
|
407
|
+
return 0
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
if __name__ == "__main__":
|
|
411
|
+
sys.exit(main())
|