ATH-MaaS/Pixelle-Video · error · ValueError
Videos list cannot be empty
Error message
Videos list cannot be empty
What it means
concat_videos validates its input before doing any work: an empty list of video paths cannot produce a concatenation, so it raises ValueError immediately (after _ensure_ffmpeg). This is a caller-contract error, not an FFmpeg failure.
Source
Thrown at pixelle_video/services/video.py:132
bgm_volume: float = 0.2,
bgm_mode: Literal["once", "loop"] = "loop"
) -> str:
"""
Concatenate multiple videos into one
Args:
videos: List of video file paths to concatenate
output: Output video file path
method: Concatenation method
- "demuxer": Fast, no re-encoding (requires identical formats)
- "filter": Slower but handles different formats
bgm_path: Background music file path (optional)
- None: No BGM
"""
self._ensure_ffmpeg()
if not videos:
raise ValueError("Videos list cannot be empty")
if len(videos) == 1:
logger.info(f"Only one video provided, copying to {output}")
shutil.copy(videos[0], output)
return output
logger.info(f"Concatenating {len(videos)} videos using {method} method")
# Step 1: Concatenate videos
if bgm_path:
# If BGM needed, concatenate to temp file first
temp_output = output.replace('.mp4', '_no_bgm.mp4')
concat_result = self._concat_demuxer(videos, temp_output) if method == "demuxer" else self._concat_filter(videos, temp_output)
# Step 2: Add BGM
logger.info(f"Adding BGM: {bgm_path} (volume={bgm_volume}, mode={bgm_mode})")
final_result = self._add_bgm_to_video(
video=concat_result,View on GitHub (pinned to 848b054e4f)
Solutions
- Check that the videos list is non-empty before calling concat_videos and handle the empty case explicitly (skip the step, or raise a domain-specific error).
- Fix the upstream generation/glob logic so at least one input video exists.
- If a single video is intended, pass it anyway — the method handles len==1 by copying it to output.
Example fix
// before
service.concat_videos(segments, 'final.mp4') # ValueError if segments == []
// after
if not segments:
raise ValueError(f'No video segments produced in {segments_dir}')
service.concat_videos(segments, 'final.mp4') Defensive patterns
Strategy: validation
Validate before calling
if not videos:
raise ValueError('No videos to concatenate')
for v in videos:
if not os.path.isfile(v):
raise FileNotFoundError(v) Type guard
def is_nonempty_file_list(videos: object) -> bool:
return isinstance(videos, list) and len(videos) > 0 and all(isinstance(v, str) and os.path.isfile(v) for v in videos) Try / catch
try:
service.concat_videos(videos, out)
except ValueError as e:
if 'empty' in str(e):
logger.warning('No segments produced; skipping concat')
return None
raise Prevention
- Guard the list for emptiness at the pipeline boundary before calling concat_videos.
- Check upstream generation steps: if all segment creation failed, stop early with a clear message.
- Log the number of segments before concatenation to catch silently-empty lists.
- Prefer passing a single video rather than special-casing around the empty case.
When it happens
Trigger: Calling concat_videos([]) or passing a list that ended up empty because an upstream filtering step removed all candidate files (e.g. glob matched nothing, all files failed validation).
Common situations: Dynamic pipelines where segments are generated conditionally and all generation steps failed; glob patterns with wrong extensions returning no matches; refactored code that now returns a list instead of a tuple and drops a default item.
Related errors
- Invalid DashScope media combination: {'+'.join(sorted(media_
- frame_template is required to determine media size
- Progress must be between 0.0 and 1.0, got {self.progress}
- 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/d20571811c4c0abc.
Report an issue: GitHub.