ATH-MaaS/Pixelle-Video · error · ValueError
Unknown media type: {frame.media_type}
Error message
Unknown media type: {frame.media_type} What it means
In _step_create_video_segment, the processor switches on frame.media_type to decide how to build the video segment; any value other than the known kinds (e.g. 'image' or 'video') reaches the else and raises ValueError. It is a second, independent media-type dispatch point from [107], operating on the storyboard frame rather than the media result.
Source
Thrown at pixelle_video/services/frame_processor.py:441
# Clean up temp file
import os
if os.path.exists(temp_video_with_overlay):
os.unlink(temp_video_with_overlay)
elif frame.media_type == "image" or frame.media_type is None:
# Image workflow: Use composed image directly
# The asset_default.html template includes the image in the composition
logger.debug(f" → Using image-based composition")
segment_path = video_service.create_video_from_image(
image=frame.composed_image_path,
audio=frame.audio_path,
output=output_path,
fps=config.video_fps
)
else:
raise ValueError(f"Unknown media type: {frame.media_type}")
frame.video_segment_path = segment_path
logger.debug(f" ✓ Video segment created: {segment_path}")
async def _get_audio_duration(self, audio_path: str) -> float:
"""Get audio duration in seconds"""
try:
# Try using ffmpeg-python
import ffmpeg
probe = ffmpeg.probe(audio_path)
duration = float(probe['format']['duration'])
return duration
except Exception as e:
logger.warning(f"Failed to get audio duration: {e}, using estimate")
# Fallback: estimate based on file size (very rough)
import os
file_size = os.path.getsize(audio_path)View on GitHub (pinned to 848b054e4f)
Solutions
- Inspect frame.media_type at failure and fix the storyboard/config to use the exact expected literal ('image' or 'video').
- Normalize with frame.media_type.strip().lower() before dispatch.
- Validate storyboard frames at load time against an allowed set of media types so errors surface before expensive media generation.
- If a new type is intended, extend _step_create_video_segment with a branch that composes a segment for it.
Example fix
// before
else:
raise ValueError(f"Unknown media type: {frame.media_type}")
// after
media_type = (frame.media_type or "").strip().lower()
if media_type not in ("image", "video"):
raise ValueError(f"Unknown media type: {frame.media_type!r}")
# dispatch on normalized media_type Defensive patterns
Strategy: validation
Validate before calling
ALLOWED_FRAME_TYPES = {"image", "video"}
def validate_storyboard(frames) -> None:
for i, f in enumerate(frames):
mt = (getattr(f, "media_type", "") or "").strip().lower()
if mt not in ALLOWED_FRAME_TYPES:
raise ValueError(f"frame {i}: bad media_type {f.media_type!r}")
validate_storyboard(storyboard.frames) # before calling the processor Type guard
def is_supported_frame(frame) -> bool:
mt = getattr(frame, "media_type", None)
return isinstance(mt, str) and mt.strip().lower() in {"image", "video"} Try / catch
try:
await processor(storyboard, config)
except ValueError as e:
if "Unknown media type" in str(e):
logger.error("storyboard frame media_type invalid: %s", e)
# regenerate/repair storyboard, skip frame, or abort pipeline
else:
raise Prevention
- Validate all StoryboardFrame.media_type values when loading/authoring storyboards, not mid-pipeline.
- Author storyboards programmatically from a fixed enum instead of hand-written strings.
- Keep the storyboard schema and processor dispatch branches in sync via a shared constant list.
When it happens
Trigger: Running the pipeline (__call__ -> _step_create_video_segment) with a StoryboardFrame whose media_type is misspelled, mixed-case, empty, or a newly introduced type that this branch (and its ffmpeg/imageio composition path) does not handle.
Common situations: Storyboard JSON authored by hand or by an LLM containing media_type like 'Image' or 'gif'; schema drift between the storyboard generator and the processor; a new media kind added upstream without updating this switch.
Related errors
- Unknown media type: {media_result.media_type}
- Progress must be between 0.0 and 1.0, got {self.progress}
- frame_template is required to determine media size
- No assets provided. Please upload at least one image or vide
- Unknown pipeline: '{pipeline}'. Available pipelines: {availa
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/b7f1e43371795e27.
Report an issue: GitHub.