SYSTEM:
You are an expert accessibility writer for film/TV and e-learning. Produce STRICT JSON only.

USER:
You are given a video. Return a JSON object with:
- language: "{TARGET_LANGUAGE}" (the target language you are writing in)
- confidence: 0..1 (how confident you are in understanding the video content)
- summary: 1-2 sentence synopsis (written in {TARGET_LANGUAGE})
- transcript_plaintext: full spoken words, punctuated, translated/written in {TARGET_LANGUAGE}
- captions_vtt: a valid WebVTT file as a single string, with accurate timings and no styling (written in {TARGET_LANGUAGE})
- audio_description_vtt: a valid WebVTT file as a single string, describing key visual elements (no spoilers), synchronized with the program (written in {TARGET_LANGUAGE})
{SDH_FIELD}
{SOURCE_HAS_AD}

TARGET LANGUAGE: {TARGET_LANGUAGE}

CRITICAL LANGUAGE REQUIREMENT:
- You MUST write ALL outputs in {TARGET_LANGUAGE}
- Watch the video carefully and understand the spoken content and visual elements
- Write captions that convey the spoken content accurately in {TARGET_LANGUAGE}
- Write audio descriptions in {TARGET_LANGUAGE} based on what you SEE in the video
- Use natural, native-level {TARGET_LANGUAGE} expressions and phrasing
- Do NOT write in the original language of the video - everything must be in {TARGET_LANGUAGE}
- Ensure translations sound natural to native {TARGET_LANGUAGE} speakers

Constraints:
- Output MUST be valid JSON. Do not include markdown fences or any other text.
- All JSON strings must be properly escaped (use \" for quotes within strings)
- Write clear, concise audio descriptions — prioritise accuracy and comprehension over length. Be succinct; omit redundant or obvious details.
- WebVTT must start with "WEBVTT" and follow this exact format:
  - Timestamp format: HH:MM:SS.mmm --> HH:MM:SS.mmm (ALWAYS include hours, even if 00:)
  - Example: "00:01:23.456 --> 00:01:27.890"
  - Each cue must be separated by blank lines
  - Never use MM:SS format - always include the hour component
- Escape all newlines in VTT strings as \n
- Do not include trailing commas in JSON objects or arrays

CRITICAL TIMING REQUIREMENTS:
- Caption timing must be PRECISELY synchronized with the actual speech in the video
- Each caption cue should start exactly when the speaker begins that phrase/sentence
- Each caption cue should end exactly when the speaker finishes that phrase/sentence
- Listen carefully to detect natural speech pauses and word boundaries
- Avoid starting captions too early or ending them too late
- Caption ALL audible speech — include off-screen narrators, voiceover, and any speaker not visible on screen. Do NOT omit speech because the speaker is not visible or because it plays over non-dialogue segments.
- For audio descriptions, time them during natural speech gaps or over non-dialogue audio
- Validate that all timestamps are monotonically increasing (each cue starts after the previous one ends)

BRAND NAMES AND PRODUCTS:
{BRAND_CONTEXT}
- You MUST use the exact brand names from the list whenever those products are visible on screen
- Always prefer the brand name over a generic description — e.g., "Sellotape" not "sticky tape", "Post-it notes" not "sticky notes", "3M VetBond" not "tissue adhesive"
- If a product is on the brand list, use the brand name even if the label is partially obscured — use your best confident identification
- If a product is NOT on the list or is completely unclear, use a generic descriptor — do not invent brand names

{GLOSSARY}

CAPTION FORMATTING (DCMP standard):
- Maximum TWO lines per caption. Never use three or more lines.
- Each line should be no longer than ~37 characters where possible (42 absolute max)
- Do NOT split lines in the middle of: a modifier and its word, a prepositional phrase, a person's name and title, after a conjunction (and/or/but/because), or between an auxiliary verb and the word it modifies
- Do NOT start a new sentence on the same line where a previous sentence ends (unless both sentences are very short and closely related)
- Minimum caption duration: approximately 1.3 seconds. Maximum: 6 seconds
- Use mixed case. Use ALL CAPS only for screaming or shouting

DISFLUENCY REMOVAL (DCMP §6.01):
- Do NOT include filler words, false starts, or hesitations in captions
- Remove: "um", "uh", "ah", "er", "hmm", "like" (as filler), "you know" (as filler), "I mean" (as filler)
- Also remove language-specific fillers (e.g., "euh"/"beh" in French, "äh"/"ähm" in German, "eh"/"este" in Spanish, "ehm"/"allora" in Italian)
- Remove false starts when the speaker self-corrects immediately (e.g., "I was — I went to the store" → "I went to the store")
- Do NOT remove meaningful repetition, emphasis, or intentional stylistic choices

SOUND AND MUSIC FORMATTING (DCMP standard):
- Sound effects: lowercase in square brackets — e.g., [door slams], [footsteps approaching]
- Use present participle for sustained sounds: [dog barking]; use third person for abrupt sounds: [dog barks]
- Background music with lyrics: use the ♪ music symbol, e.g., ♪ Here comes the sun ♪
- End of a song: use double music symbols, e.g., ♪ last lyric line ♪♪
- Offscreen sounds and offscreen music: wrap in VTT italic tags, e.g., <i>[phone ringing]</i>, <i>♪ upbeat jazz ♪</i>
- Do not caption background music shorter than 5 seconds
- Describe music mood objectively using brackets, e.g., [suspenseful orchestral music] — avoid subjective words like "beautiful" or "haunting"
- For standard captions (non-SDH): include significant non-speech audio events in brackets when they are essential for understanding the content

CAPTION PLACEMENT:
- Captions are normally positioned at the bottom of the screen
- When visible text, graphics, logos, or on-screen information appear at the bottom of the frame during a caption cue, add the VTT cue setting "line:0%" to move that caption to the top — format: "00:00:01.000 --> 00:00:03.000 line:0%"

ETHICAL GUIDELINES FOR DESCRIBING PEOPLE (DCMP standard):
- Consistently identify people/characters by name. When a name is not yet known, identify by the most obvious visible attribute (e.g., "the person in the red jacket") until the name is established, then switch to the name and use it consistently
- Describe discernable physical attributes and observable gestures — do NOT infer or state emotional states
  - CORRECT: "She furrows her brow and clasps her hands."
  - INCORRECT: "She looks worried."
  - CORRECT: "He raises his fist."
  - INCORRECT: "He appears angry."
- Race/ethnicity: use currently-accepted, respectful terminology; if you describe one person's racial or ethnic background, be consistent and describe all people in the same scene
- Do NOT guess at racial, ethnic, gender, or religious identity if not clearly confirmed — use neutral descriptors (e.g., "a middle-aged person") rather than specifying when uncertain
- For disabilities: describe observable facts only (e.g., "a person using a motorized wheelchair") — do not interpret capability or emotional state
  - CORRECT: "A person using a motorized wheelchair enters the room."
  - INCORRECT: "A disabled person in a wheelchair rolls in."
- Avoid language that stereotypes, sensationalises, or assigns motivation based on appearance
- For animals: use "it" or "the [animal]" — do NOT use gendered pronouns (he/she) unless the animal's sex is explicitly established in the dialogue or on-screen content
  - CORRECT: "The cat stretches on the windowsill."
  - INCORRECT: "He stretches his paw across the windowsill." (when sex is not established)

AUDIO DESCRIPTION GUIDELINES (DCMP standard):
Priority order for what to describe (use available time wisely):
1. ESSENTIAL: Actions and details critical for following the narrative; information that would cause confusion if omitted; scene context and setting
2. HIGH PRIORITY: Significant character appearance relevant to the story; visual details supporting understanding; scene changes and time passages
3. TIME-PERMITTING: Additional aesthetic or contextual details

Rules:
- Start generally (establish the context), then move to specific details
- Place descriptions BEFORE the visual content they refer to when possible (pre-teaching), not after
- Use present tense, active voice, and third-person narrative (e.g., "Ted breaks the window" not "The window was broken by Ted")
- Use clear, concise, complete sentences; sentence fragments only if time is severely limited
- Describe objectively without personal interpretation, censorship, or comment
- Do NOT use cinematic terminology such as "close-up", "pan", "cut to", "flashback", or "montage" unless absolutely necessary for comprehension
- ON-SCREEN TEXT (MANDATORY): You MUST describe ALL visible text — titles, lower-thirds, signs, captions, graphics, URLs, phone numbers, product labels. Use the format: "Text on screen reads: [exact text]". If text appears for less than one second, note it in the nearest available gap. Do NOT silently skip any on-screen text.
- Treat song lyrics as dialogue — describe the song, do not describe over the lyrics while they are playing
- Describe colors, clothing, setting, and spatial relationships when relevant to understanding
- Be succinct — omit redundant or self-evident details
- Do NOT duplicate information already in the spoken dialogue
- Write all descriptions in natural, fluent {TARGET_LANGUAGE}

{SDH_GUIDELINES}

CRITICAL: Return ONLY valid JSON that can be parsed by JSON.parse(). No additional text.

Example output format (if TARGET_LANGUAGE were Spanish):
```json
{
  "language": "es",
  "confidence": 0.95,
  "summary": "Un video tutorial que muestra como usar una aplicacion web de panel de control.",
  "transcript_plaintext": "Hola a todos, bienvenidos a este tutorial. Hoy vamos a explorar la interfaz del panel de control. Primero, iniciemos sesion en el sistema.",
  "captions_vtt": "WEBVTT\n\n00:00:01.000 --> 00:00:03.500\nHola a todos, bienvenidos\na este tutorial.\n\n00:00:04.000 --> 00:00:07.200\nHoy vamos a explorar la interfaz\ndel panel de control.\n\n00:00:08.000 --> 00:00:10.500\nPrimero, iniciemos sesion en el sistema.",
  "audio_description_vtt": "WEBVTT\n\n00:00:00.500 --> 00:00:02.000\nUna pantalla de computadora muestra una pagina de inicio de sesion moderna con marca corporativa azul y blanca.\n\n00:00:05.000 --> 00:00:07.000\nUn cursor se desplaza sobre el campo de nombre de usuario, que se resalta con un borde azul sutil.\n\n00:00:10.000 --> 00:00:12.000\nLa pantalla revela un panel completo con graficos coloridos y widgets de datos."
}
```

Follow this exact structure and formatting, but write all content in {TARGET_LANGUAGE}.
