/agent-edite-davinci-resolve:thai-subtitles-resolvefrom agent-edite-davinci-resolve
Insert, style, and CTC-sync Thai subtitles in Resolve.
Ships in agent-edite-davinci-resolve. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use when adding Thai (or any non-spaced-script) subtitles to DaVinci Resolve
timelines from audio: Whisper ASR -> N-words-per-caption SRT -> scripted import
to subtitle tracks, verified by readback.
Built and proven on Resolve Studio 21.1.0.17, RTX 4060, 12 gameplay shorts.
Create and continue dialogue captions only on native Resolve Subtitle tracks.
Do not substitute Text+ / TextPlus, Fusion titles, or text clips on video
tracks, even when their styling is easier. Preserve unrelated titles/overlays.
For authorized legacy migration or interrupted-work verification, read
references/native-caption-migration.md before any mutation.
If the user handles fonts/styles, stop at verified cue insertion; do not apply
an old font/style plan, copy a style blob, or write SQL on their behalf.
Use this skill when an SRT is already in the Media Pool, when the user asks “ใส่ subtitle track”, “จัดฟอนต์”, or “โหลด preset”. Do not retranscribe audio or regenerate cues for an insertion/style-only request.
Before importing a Thai SRT, lint it offline: python scripts/caption_lint.py <file.srt>
(at most 14 Thai characters and 1.5 s per cue, no spaces between Thai characters;
exit code 1 on any violation). It only reports; splitting or flagging text stays an
editorial decision.
Read references/srt-insertion-and-presets.md for the complete procedure:
{"mediaPoolItem": item} append payload. Wait at
least ~1.2s between structural mutations and read back every cue.Mitr-Font and Mitr Font are different identifiers; ask before substituting.
Prefer the user-approved saved preset over guessed font/size/position values.scripts/drt_clone_subtitle_style.py
(clone from a reference DRT) or scripts/drt_set_subtitle_preset.py (set the
preset bytes from User.db in an exported DRT, import, rename by ID; see the
reference's DRT section). Otherwise, on observed Resolve 21.1.0.17, subtitle
preset loading has no public Python
API. scripts/load_subtitle_preset.py is a Python database workaround,
not a native API setter. Require separate explicit database-write approval;
save, verify a DRP backup, close the project, snapshot SQLite, update exact
subtitle rows transactionally, reopen, save, and verify.The preset helper verifies style bytes and cue counts, not complete cue text,
frames, video/audio coverage or the Media Pool folder. Capture and compare those
separately; do not describe its success message as full editorial verification.
If a script fails after append, re-read the live track before retrying: the
subtitles may already be present. SetCurrentTimeline belongs to Project,
not ProjectManager.
Worked for a 72 s gameplay clip: ffmpeg decode -> scripts/asr_words_th.py (faster-whisper
large-v3 on the RAW audio, char-level times + pythainlp) -> hand-curated cue starts ->
scripts/build_dynamic_srt.py -> scripts/caption_lint.py -> import.
large-v3 beat large-v3-turbo on this material: turbo invented text for ~20 s of gameplay
audio (lp -1.9). Re-transcribe a doubtful 20-30 s window alone with beam_size=8; the
voice-band-filtered pass can merge a whole window into one unusable segment, so use it only
as a corroborating reading.media_pool.import_media -> timeline.add_track
(track_type: subtitle) -> media_pool.append_to_timeline with clip_ids (95 cues, read-back
verified). It auto-archives a copy Timeline N_archived_vNN per mutating call and may leave
the Media Pool folder on Archive; report both and clean up only on request.scripts/verify_srt_on_timeline.py <srt>. It reads the CURRENT timeline, so
activate the target first (another timeline's copy can differ, e.g. an extended cue).scripts/load_subtitle_preset.py --backup-dir is now resolved to an absolute path; a relative
path made Resolve's ExportProject fail ("DRP backup failed; nothing written").Mitr Font exists, Mitr-Font does not. Ask, never substitute.0.3–1.0 s early/late drift. Always derive cue starts from word-level ASR (or forced alignment + RMS onset) on the cut timeline audio, and verify spoken phrasing (e.g. ทุกคน vs ทุกๆคน, ให้ผมด้วย vs ให้ผมเลย, trailing particles like แล้วนะครับ) before final delivery.asr_words_th.py --model large-v3 -> words_to_short_srt.py gave 604 lint-clean cues that read
back with 0 mismatches, yet the user stopped it: "ไม่ตรงกับเสียง". Whisper's Thai words were wrong and it
appended English translations ("So, if no one says that it's a birthday"). A frame readback proves the
track equals the SRT, never that the SRT matches the speech; listen to a sample before a full insert.import_media with a direct upload of the extracted 16 kHz WAV
(language: th, 36 MB PUT, ~2 min) -> export_transcript format=srt include_speaker_labels=off -> 153
segments of 4-10 s, two lines, with accurate Thai ("4 ตุลาคม", "วันเกิดหนู"). Some segments end exactly
4.000 s after their start: Descript's placeholder length, so timing inside them is a guess.p2_fix_captions.fix() (word boundaries <= 14 chars, time shared by character count, 1.5 s cap),
strip Thai-Thai spaces, then replace the track (delete subtitle tracks, NEW SRT path, bare append):
153 -> 836 cues, verify mismatches=0 (a one-off scratch script wrapped fix()).verify_srt_on_timeline.py reports every two-line cue as a
text mismatch while frames match; compare after normalising, or split to one-line cues first.timeline delete_track auto-creates <timeline>_archived_v01; report it, delete only on request.nectec/Pathumma-whisper-th-large-v3
converted with ctranslate2.converters.transformers stopped after 2 h) because Resolve and other jobs
shared the GPU. words_to_short_srt.py stays for word-timed ASR JSON, not as the default route.import_media direct upload of the
16 kHz mono WAV (language: th, 4 MB, PUT 200, import done in ~40 s) -> export_transcript format=srt include_speaker_labels=off (18 segments, accurate Thai; it wrote the channel name as เคทิ, fix to เคที่).build_subs_epN scratch copies: <= 14 chars, <= 1.5 s). Segment
line breaks matched measured pauses; the only misplacement was a whole run assigned to the previous segment by
midpoint (fixed by reading the next segment's first words).language has no th any more; hand phrases on the speech map (2026-11-12, Laffy 004, 92.8 s @ 30 fps)import_media language enum now lists no th; language: auto transcribed the Thai read
correctly (17 segments). A 128 kbps mono MP3 (1.5 MB) uploaded with one PUT; import took ~50 s.laffy004/build_subs.py, gitignored): one (descript start, text) row per segment,
phrases split by hand with |; the window runs from the segment's start to the next one's start, and each
phrase is spread over the -40 dB / 80 ms speech runs inside it by character weight (Latin x0.8), so cues follow
the talking and skip the silences.caption_lint.py counts every Thai code point (vowel and tone marks too): การ์ดที่มีชื่อว่า is 17. Phrases that
read naturally often exceed 14, so re-split them at newmm boundaries (custom dict for names such as ราฟฟี่) and
then re-check the list for orphan one-word cues (แสง, ได้, ตัว) and fix them by hand.Mitr Font for a new channel: the user approved borrowing the Katy404 ep6 16:9 styled track
(.hermes/projects/bunny-girl-ep6/substyle/styled_subs.drt) for Laffy. drt_clone_subtitle_style.py now keeps
the source subtitle track's name; before that fix the reference's Subtitle 1 replaced Thai and the snapshot
check stopped on that name alone. Fusion zoom comps on V2 survived the DRT round trip (Transform read back equal).TimelineItem.SetName on a subtitle item fails (MCP set_name -> success false). Patch the cue
element's Name in an exported DRT and re-import; the track style is kept (Laffy ราฟฟี่ -> ลาฟฟี่, 2026-11-13).มาเป็น 0.6 s before its
word (it sat after a 0.5 s pause). A speech-map DP (scratch laffy004/align_subs.py: 10 ms RMS runs at -38 dB,
Descript segment starts as anchors, block cost on duration + envelope syllable peaks, a penalty per cue boundary
inside continuous speech, cues >= 10 frames) fixes most starts, but a pause between two equal-syllable phrases is
ambiguous on audio alone: take the user's ear as a pin (PINS). Apply new times by DRT (Start/Duration +
_patch_fields_blob), import as the same name, compare every non-subtitle item, render one frame in the pause and
one on the word. Local faster-whisper (even small) hung > 5 min while Resolve held the GPU: do not rely on it.Character-count splitting inside a Descript segment looks fine on an energy check yet drifts up to 1.7 s at
pauses. Verify with three references together: Descript segment starts (they hit the voice onset within
~0.05 s; exact 4.000 s ends are placeholders), the 10 ms energy map, and local Whisper word times used only
for relative timing inside a segment (user-approved timing reference; text stays Descript). Re-pack cues at
pauses (<= 14 Thai chars, <= 1.5 s), keep names in a custom newmm dictionary (ลาฟฟี่, แหยะๆ) and glue a
lone ๆ to its word. Accept only when every segment's spread against Whisper is small, no cue starts in
silence and no speech is uncovered; then replace the track by DRT (clone_styled_subtitle_track with the
timeline's own DRT as the style source) and compare every non-subtitle item. Details: OPERATING-NOTES.
Measured against 71 speech onsets (10 ms energy, >= 0.25 s silence before): faster-whisper large-v3 Thai word
times lead the voice by 0.36 s median (p10 -0.74, p90 +0.22) and leave holes (one 8 s token at 136-144.6 s,
nothing at 84-89 s); a Whisper-anchored build still had 70/251 cues off by > 0.2 s (max 1.3 s). CTC forced
alignment of the cue text with airesearch/wav2vec2-large-xlsr-53-th (HF, Thai char vocab, 20 ms frames,
torchaudio.functional.forced_align, 20 s chunks on GPU) landed within 0.05 s median of the onsets. Recipe
(scripts in scripts/scratch/laffy_reason/): forced_align.py (map Latin names to spoken Thai, drop ๆ),
retime.py (start = aligned start - 0.04 s snapped to an onset within 0.15 s; end = next start if the gap
< 0.5 s else aligned end + 0.25 s; cap 45 f; merge cues under 8 f when the result is <= 14 chars; keep the
old time where the CTC score < 0.35), local_ctc.py START END "text" ... to compare candidate texts or
re-split a phrase (higher mean log-prob wins). Watch for Descript splits that put the previous sentence's
ครับ at the start of the next cue. A nearest-onset metric still reports mid-cue pauses and -37 dB blips:
read each flag before calling it a miss.
Second run (Laffy แนะนำตัว, 146.9 s, 151 cues already "synced" with Whisper times): CTC still found 35 starts
off by > 0.2 s, worst 1.3 s early (a cue shown during an อ่าม filler before the word) and 1.07 s late, so
a Whisper-timed track is not verified. Use the greedy CTC decode per cue to list text suspects, then score
each suspect with local_ctc.py candidates: it settled บ้าง->มั่ง (-4.0 vs -6.3) and นี้->เนี้ย
(-8.3 vs -10.9), and kept names and meaning where the greedy decode mishears (มีชื่อว่า vs ไม่เชื่อว่า
scored -4.2 vs -4.0: a near-tie is not evidence; keep the Descript text). The intro scripts take a jobs
file (scripts/scratch/laffy_intro/local_ctc.py jobs.json) so the model loads once for many checks.
Delivery gates (verified on the intro run; full procedure in
references/ctc-retime-delivery.md): retime into a NEW <variant>_v2 timeline, never the
master — verified DRP snapshot first (before_subs_v2.drp), DRT clone of the timeline's own
styled subtitle track, import with importSourceClips: False, then read back EVERY video/audio
item (range, LeftOffset, AudioVolume, V2 Fusion transform) plus the exact cue list before
saving. Merge flash cues (< 8 f) into the neighbour only when the combined text stays <= 14
chars (น่ะ 7 f -> สัมผัสมันเฉยๆน่ะ, 151 -> 150 cues). Deliverable QC: burn-in render, ffprobe
frame count equal to the source (4407), loudness unchanged (-14.4 LUFS, ebur128=peak=true),
and 6 sample stills via scripts/render_subtitle_stills.py (native stills omit subtitles)
inspected for correct, non-overlapping, on-frame captions. Near-tie CTC scores keep the
Descript text; record kept-uncertain cues in the channel doc.
timeline_ai.list_captions_live
and write_captions_live on observed Resolve 21.1.0.17. Ordinary native cues read
with words: [], but replacement with an empty words array is refused. A single
whole-phrase word record with the cue's exact text/start/end passed live readback.
Dry-run first, use a named revision, and compare every cue and non-subtitle item.GetRightOffset() by one frame even when record bounds and
source bounds match; log that separately rather than claiming byte-identical edits.Compare the dialogue-reference waveform to the rendered audio in windows at the start, middle, and end. If the lag is effectively zero, correct individual cues against phrase edges and word-timing evidence rather than shifting the whole track. Check the actual burn-in separately: Resolve cue readback confirms placement, not speech sync.
Descript exports coarse 4–10 s segments (with 4.000 s placeholder ends), so cues split by character count can drift 0.8–3.2 s off the live voice even when caption_lint.py reports 0 problems, verify_srt_on_timeline.py matches 100%, and burn-in QC sees pixels inside every cue's own window. Before importing any Descript-derived SRT into 16:9 or cloning it to 9:16:
16 kHz mono WAV from the cut timeline's audio (after head/tail trims and any A1 splits) and compute a 10 ms RMS envelope alongside airesearch/wav2vec2-large-xlsr-53-th CTC log-probabilities (20 ms frames).37 -> สามสิบเจ็ด, 10,000 -> หนึ่งหมื่น, 2,356 -> สองพันสามร้อยห้าสิบหก, Creeper -> ครีปเปอร์, Third Person -> เธิร์ดเพอร์สัน, เพื่อนๆ -> เพื่อนเพื่อน, or แล้วนะครับ -> แล้ว when the audio drops the particle).<= 0.20 s drift target; LEAD = 0.04 s, MAXF = 90 @ 60 fps = 1.50 s, MINF >= 16 frames), and pin scream/gameplay-SFX-overlapping exclamations directly from 10 ms RMS bursts + ASR rather than trusting raw CTC alone.caption_lint.py on the synced SRT and verify the exact (start, end, text) list on both 16:9 and 9:16 timelines after DRT style cloning (drt_clone_subtitle_style.py), then spot-check burned-in frames against the audio timestamps at early, mid, and late cues.
items = mp.ImportMedia([srt_path]) # -> MediaPoolItem, Type == "Subtitle"
tl.AddTrack("subtitle") # MUST exist first
mp.AppendToTimeline([{"mediaPoolItem": items[0]}])
Traps, each of which makes it look broken:
AppendToTimeline returns a non-empty list while placing nothing when the
timeline has no subtitle track. Add the track first.
Use the BARE {"mediaPoolItem": item} payload for SRT insertion. Do not add trackIndex, mediaType, or a placement frame: those fields can make cues start at timeline-end plus the SRT offset.
Appending to a track that already holds captions **stacks the file after
them** instead of using its own timecodes. Never append twice to one track.
Timeline.ImportIntoTimeline(srt) returns False — it is AAF-only.
Verify by readback: GetItemListInTrack("subtitle", idx), compare item count
and GetStart()/fps against the SRT. Expect sub-frame drift (<0.5 frame).
Fixing an SRT and re-importing the same path silently does nothing — the
media pool returns the item parsed at first import, and reports success.
Measured: bin stayed at 12 items instead of 24, timeline kept the old text.
Deleting the subtitle track does not help; the stale pool item is the source.
So a replace path must do all three, in order:
for idx in range(tl.GetTrackCount("subtitle"), 0, -1):
tl.DeleteTrack("subtitle", idx) # 1. old track
stale = [c for c in bin.GetClipList()
if c.GetClipProperty("File Path") == srt_path]
mp.DeleteClips(stale) # 2. cached pool item
mp.ImportMedia([srt_path]) # 3. now re-reads disk
Never trust the item count printed right after append — read it back in a
separate pass. After replacing a track, reapply any whole-track subtitle style
only when style work is authorized; otherwise report that it is deferred.
SRT import/AddTrack recreates the track's style blob as an unstyled stub. Verify
both cue content/timing and style after the replacement. And when a re-run writes
a per-item result file, MERGE with the previous record instead of overwriting, or
a targeted fix erases the verified state of every timeline it did not touch.
Do not treat word_timestamps entries as words for non-spaced scripts. Real
measured output: 'เล' 'ื' 'อ' 'ด' 'น' '้' 'อย' — 48 tokens for 65 characters,
bare consonants and floating vowel marks. Tokenizing each fragment separately
yields garbage.
What holds: **concatenating a segment's tokens reproduces the segment text
exactly**. So build a character-level time index:
pythainlp.tokenize.word_tokenize(text, engine="newmm") for real words;Then merge back tokenizer artefacts that would steal a caption slot: a lone Thai
character (แม่ง -> แม่+ง) and the repetition mark ๆ. Count block size in
list entries, never by line.split() — a rendered ได้ ๆ is one word.
Render the words JOINED, with no separator. The N-word grouping is a TIMING
decision (how much text appears at once); it is not something to spell out on
screen. Thai has no inter-word space, so emitting ถ้า จำ ไม้ looks broken to a
Thai viewer even though it makes the grouping visible — the user will ask for it
to be removed. Insert a space only where one side of the boundary is Latin
(คำ likes ด้วย), and never before punctuation. A pre-existing space around ๆ
from the ASR text is correct Thai typography; leave it.
Symptoms in real output: El操าnament, まりAR, Mensch, participant.
Detect numerically instead of by eye:
foreign_ratio = non_thai_alpha / (thai + non_thai_alpha) # > 0.12 is suspect
avg_logprob = mean(seg.avg_logprob) # < -1.5 is suspect
Remedy — re-extract voice-band audio and retranscribe:
highpass=f=80, lowpass=f=7000, afftdn=nf=-25, dynaudnorm=f=150:g=15:p=0.7
Choose per clip part, not globally. Measured: one part went -2.25 -> -0.32
(20 -> 110 words), another went -0.87 -> -1.68. Blanket-swapping trades a clean
transcript for a degraded one. Select on avg_logprob and record the decision.
English that looks wrong may be real: RoV/LoL announcer lines (First blood,
Let death bloom) are genuine game audio, not hallucination. Listen before
stripping.
Segment-level ratio checks cannot see one bad character inside otherwise-clean
Thai: มันมี를.., เต็ม膈ับ, อ่าฮะей, เอ่업อ. These reach the screen.
Filter by SCRIPT, never by confidence. Measured on this material, 180 word
tokens sit below p=0.05 and most are valid Thai fragments ('ถ' p=0.003,
'ไม' p=0.006) — a probability gate deletes real speech. Foreign glyphs are
unambiguous instead: 를/업/ей all p=0.000.
Drop Hangul/Han/Kana/Cyrillic/Arabic/Devanagari; KEEP Latin (game audio).
Do it inside the character-time-index pass so the character and its time span
die together — removing from the text alone shifts every later timing.
Removing a glyph from mid-word leaves debris the tokenizer then mis-splits, so
also rejoin to the previous word any token that (a) is a lone Thai character,
(b) starts with a combining vowel/tone mark [\u0E31\u0E34-\u0E3A\u0E47-\u0E4E]
(เต็ม膈ับ -> เต็ม + ับ), or (c) is pure punctuation (..).
model.transcribe(wav, language="th", word_timestamps=True, beam_size=5,
temperature=[0.0,0.2,0.4,0.6,0.8,1.0],
condition_on_previous_text=False, # stops hallucination loops on game audio
vad_filter=True,
vad_parameters={"min_silence_duration_ms":400, "speech_pad_ms":200})
MAX_DISPLAY_S = 1.5 (this project's approved house style; at most three short words / about 14 Thai characters) — Whisper stretches a trailing token over silence, which
parks a 3-word caption ~5 s and reads as a stuck subtitle.
Clamp order: display cap, then next_start - min_gap, then timeline end.
MIN_GAP_S ≈ 0.034 (2 frames @60) so blocks do not visually merge.
Break early on a pause >= 0.7 s — otherwise captions straddle sentences.
Never drop words to fit; flag low confidence instead and report it.
Apply these limits to newly authored cues. Do not shorten or split legacy
cues in a preserve-text-and-timing migration; report exceptions instead.
end_frame / fps; report omitted intervals and uncertain terms per clip.python -m demucs --two-stems=vocals -n htdemucs -d cuda (15 x 60 s clips in 46 s on an RTX 4060). A vocals stem with no voice above -38 dB means the clip really has no speech.faster_whisper.vad.get_speech_timestamps, threshold 0.35, max 6 s) and transcribe each chunk with vad_filter=False, condition_on_previous_text=False; run Typhoon ASR (scb10x/typhoon-asr-realtime) on the same chunk slices.ํา -> ำ) before comparing. Even at >= 0.75 agreement both models keep wrong words ("เมฆ"/"มีด", "สาว"/"สระ"), so a human or an agent proofread is still required; reject Whisper stock hallucinations (สวัสดีครับ, ขอบคุณครับ, โปรดติดตามตอนต่อไป), repetition, in-game announcer lines and background song lyrics.newmm splits them across cues ("มิฟ/ฟี่").asr_bench_th.py, not kept, 54 demucs+VAD chunks / 173 s, RTX 4060 8 GB, reference = proofread Typhoon text so it favours Typhoon): typhoon-asr-realtime CER 0.25 (median 0.14, 3 hallucinated chunks, 65x realtime); faster-whisper large-v3 0.43 (15 bad chunks, 2x); typhoon-asr-qwen-0.6b-ctx 0.44 (median 0.37, 3x); large-v3-turbo 0.54; bjak/distill-whisper-th-large-v3 median 0.32 but loops ("สวัสดีครับ" x N) on noise. Use Typhoon realtime as the primary Thai text and large-v3 only as a second opinion; neither replaces the proofread.Whisper time is relative to the extracted WAV. WAV t=0 is the clip's
tl_start_frame, so timeline_time = wav_time + tl_start_frame/fps. Multi-clip
timelines need this or part 2 lands at zero. Get ranges from
GetLeftOffset()/GetDuration() per timeline item, and check
GetProperty("Speed") — a retimed clip breaks the linear mapping.
faster-whisper/ctranslate2 needs CUDA DLLs registered before import.
On Windows with a CUDA-enabled PyTorch wheel, torch/lib can contain the
required cublas64_12.dll/cuDNN DLLs: import torch, call
os.add_dll_directory(os.path.join(os.path.dirname(torch.__file__), 'lib')),
and prepend that directory to PATH. Alternatively register the installed
site-packages/nvidia/*/bin pip-wheel directories. Probe model loading before
a long batch; ordinary torch.cuda.is_available() alone proves too little.
Resolve's own python bridge: set RESOLVE_SCRIPT_API/RESOLVE_SCRIPT_LIB,
add the install dir via add_dll_directory, then import DaVinciResolveScript.
Probe API presence with name in dir(obj) — hasattr returns True for every
name on a Resolve object, real or invented.
Activate each timeline before capturing its playhead: on observed 21.1.0.17,
an inactive Timeline.GetCurrentTimecode() returns the active timeline's
timecode. Never restore an inactive-read value onto another timeline. Wait
after activation and read its own timecode; capture the current active state
again when resuming instead of restoring stale session state.
OpenPage() can return True before GetCurrentPage() changes. Wait and read
back the requested page before final save/state assertions, and serialize
live Resolve calls; a successful render can otherwise be followed by a false
restoration failure.
Resolve constants (resolve.SUBTITLE_LANGUAGE, AUTO_CAPTION_THAI) are
absent from dir() yet readable via getattr — absence from dir() is not
absence.
Source media is read-only: ffmpeg decodes the original and writes NEW scratch
WAVs. Only project-database state changes (subtitle track + items + one media
pool item per SRT). Create/delete a scratch timeline only within explicit scope;
when extra timelines are prohibited, use a verified DRP backup instead.
Skip timelines that already have a subtitle track unless --replace is passed,
so a re-run cannot silently double captions.
Direct database writes require explicit authorization for that operation;
permission to insert subtitles or change a font is not permission to write SQL.
Read before writing: inspect one reference track in Resolve's Track Inspector and compare the EffectFiltersBA keyed-dict value on every target Sm2TiTrack.FieldsBlob (Type=2). If all values are byte-identical, the whole-track style already matches; leave the database untouched. Different non-style keys (such as ExcludeTrackFromSequenceCaching) do not require replacement. Qt's QFont descriptor pointSize is not the Inspector Size (e.g. an 8.14286 descriptor displayed as Size 58), so do not set an Inspector size by assigning that number to pointSize. Resolve's Stroke checkbox is labeled Outside Only, not Outline Only: checked keeps the white fill and places the stroke outside the glyph.
When no supported scripting setter exposes Subtitle Track Inspector styling,
use the current saved track's style blob, not an older template: a UI edit
of Position Y changes the live Sm2TiTrack.FieldsBlob. First export a .drp,
verify target timeline IDs/counts/texts and the reference track's approved GUI
position, save and close the Resolve project, then take a SQLite backup.
Update only the exact new subtitle-track rows (Type=2) with a transaction;
never alter source media or unrelated tracks. Reopen and save the project, then
verify every target cue/text/frame and exact blob equality with the reference.
If the style blob has an unexpected shape or the project cannot close, stop
before writing SQL; do not assume a stale style template still has the user's
latest Y value.
The same machinery extends to sweetening. Verified on Studio 21.1.0.17:
Rapid AppendToTimeline CRASHES Resolve. A tight loop placing 3 SFX + 1 BGM
survivable in isolation, so the trigger is the RATE — Resolve is still saving
the project and writing timeline backups when the next append lands
(davinci_resolve.log shows back-to-back "Start saving project"). For this project, start with at least ~1.2s between structural mutations (DeleteTrack/AddTrack/AppendToTimeline), save/read back between batches, and print progress per item. Shorter isolated append delays are historical measurements, not a safe general batch default.
Do not trust the crash log's last lines. Here they read `Video decoder is
destroyed with live file handle+Unsupported clip format for audio decoding
... GIF`, which framed the GIF as the culprit. The identical pair appears in
runs that succeed. Isolate by re-running each operation separately against a
DUPLICATE of a real timeline.
Isolation probes must reproduce the real condition. A first probe placed a
GIF over an empty V1 and "passed", proving nothing — the media pool's video
masters live in a SUBFOLDER, so a root-only scan found no spine. Duplicate an
actual timeline (DuplicateTimeline) instead of assembling a fake one.
Audio level is AudioVolume, in dB — Volume, Gain, Level,
AudioGain, ClipVolume all return False from both Set and Get, looking like
a working call that did nothing. GetProperty() with NO arguments enumerates
the real keys; do that before guessing. SetTrackProperty does not exist, so
level is per item, and there is no keyframe/fade API — a music bed can only be
a flat level (~-26 dB under speech), never ducked.
GIFs: ImportMedia accepts them, Resolve conforms the frame rate itself
(47 frames @25fps -> 112 @60fps), but they carry no alpha — a full-frame
placement is an opaque rectangle. Scale to ~0.25 via ZoomX/ZoomY and place
with Pan/Tilt (pixels from centre). Check a rendered frame: on gameplay the
right side is usually HUD (clock/score/FPS) and the far left is the minimap.
Choose cues from evidence, not randomly. Merge energy peaks (RMS rise above
the clip's OWN rolling baseline — a fixed dB gate mis-fires across clips that
differ by 10 dB) with the subtitle words at that moment for mood. Require a
large rise (~25 dB) before placing anything on a peak with no mood word, or
most cues end up unjustified. Filter explicit filenames out of automatic
selection.
A cue must END inside the timeline, not merely start inside it. Guard the
cue's start + duration against the timeline length; checking only the start
extended a 45s clip to 48s and added black frames after the picture. Verify by
comparing each timeline's current length against its original.
ffprobe's GIF duration is not what Resolve uses. A malformed or
single-frame GIF (ffprobe: 0.1s / 1 frame) is placed as a 5s still. 25 of
163 files in one library were like this. Treat any GIF under ~0.4s as 5s when
budgeting room, or the tail guard above silently fails.
Do not name a loop-local text when the enclosing loop scans a string
called text with text.find(tok, cursor). Shadowing it makes every later
lookup search the previous token, return -1, and silently drop the rest of
the segment — output collapses to one word per segment with no error.
all() on an empty iterable is True, and Thai vowel/tone marks are not
isalnum(). Testing "is this token punctuation?" with
not any(c.isalnum() ...) classifies ordinary Thai words as punctuation.
Use unicodedata.category(c).startswith("P").
When a fix changes more files than predicted, diff before importing: here 6 of
12 SRTs changed rather than the expected 3, and the extra 3 turned out to be
genuine improvements (Jr . 2 -> Jr. 2). Verify the surprise, do not assume
it is either fine or broken.
Before any script, check the davinci-resolve MCP catalog; write a Resolve Python scripting-API script only after a stated MCP-GAP: line shows the MCP lacks the tool/action. Follow AGENTS.md "Tool selection" and run python scripts/resolve_preflight.py --need <tool[.action]>.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub pong34811/agent-edite-davinci_resolve --plugin agent-edite-davinci-resolve98 skills in this plugin
/agent-edite-skills-catalogInventory, read, and route this repo's project skills./agent-skill-repo-releaseVersion, tag, push, and publish skill-repo releases./davinci-resolve-apiComprehensive guide for scripting DaVinci Resolve Studio via its Python API. Covers environment setup, connection, project management, media pool operations, timeline building, clip placement, color management, rendering, and export. Requires DaVinci Resolve Studio (free version does not include scripting API).