MediaRouter / docs /template-output-validation.md
basyx's picture
Add word-by-word motivational captions template (#3)
8939f6f
|
Raw History Blame Contribute Delete
1.55 kB

Template final-output validation

Template runs validate the final artifact before publishing it to the media download layer.

Checks

  • The final artifact exists and has a non-zero file size.
  • The artifact's extension matches the template's declared output format (except source, which preserves the input format).
  • Probeable media is passed through the existing FFprobe validation path. The probe rejects outputs without decodable audio/video streams.
  • When stream metadata is available, the final check confirms that audio and video MIME types have their corresponding stream and that reported audio/video duration is positive.

A failed check raises a template execution error, so the output is not published as a successful result.

Response metadata

Successful template responses include an output_validation object in metadata, for example:

{
  "output_validation": {
    "valid": true,
    "size_bytes": 4821093,
    "mime_type": "video/mp4",
    "container": "mov,mp4,m4a,3gp,3g2,mj2",
    "duration_seconds": 31.25,
    "video_stream_count": 1,
    "audio_stream_count": 1,
    "resolution": {
      "width": 1080,
      "height": 1920
    }
  }
}

Stream counts, container, duration, and resolution can be null when the output type is not probeable or a metadata field is unavailable. The file size and MIME type are always reported for a valid file artifact.

This validation is applied to template pipeline outputs; it does not imply that every standalone media endpoint has the same response metadata.