ATH-MaaS/Pixelle-Video · error · RuntimeError

Failed to concatenate videos: {e}

Error message

Failed to concatenate videos: {e}

What it means

This is the generic catch-all in _concat_filter: any exception that is not CalledProcessError (e.g. OSError, TypeError, ffmpeg-python parse errors) is logged and re-raised as this RuntimeError. It signals an unexpected failure during filter-based concatenation rather than a documented ffmpeg exit code.

Source

Thrown at pixelle_video/services/video.py:253

            
            # Run command
            import subprocess
            result = subprocess.run(
                cmd,
                capture_output=True,
                text=True,
                check=True
            )
            
            logger.success(f"Videos concatenated successfully: {output}")
            return output
        except subprocess.CalledProcessError as e:
            error_msg = e.stderr if e.stderr else str(e)
            logger.error(f"FFmpeg concat filter error: {error_msg}")
            raise RuntimeError(f"Failed to concatenate videos: {error_msg}")
        except Exception as e:
            logger.error(f"Concatenation error: {e}")
            raise RuntimeError(f"Failed to concatenate videos: {e}")
    
    def _get_video_duration(self, video: str) -> float:
        """Get video duration in seconds"""
        try:
            probe = ffmpeg.probe(video)
            duration = float(probe['format']['duration'])
            return duration
        except Exception as e:
            logger.warning(f"Failed to get video duration: {e}")
            return 0.0
    
    def _get_audio_duration(self, audio: str) -> float:
        """Get audio duration in seconds"""
        try:
            probe = ffmpeg.probe(audio)
            duration = float(probe['format']['duration'])
            return duration
        except Exception as e:

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Check the wrapped message and the logged 'Concatenation error' line for the underlying exception type.
  2. Sanitize the videos list: ensure all entries are existing, non-None str paths.
  3. Check disk space and permissions for the output location.
  4. If the cause is an ffmpeg exit failure, look for the sibling CalledProcessError path (error 123) behavior and fix inputs accordingly.

Example fix

// before
service.concat_videos([pathlib.Path('a.mp4'), None, 'b.mp4'], 'out.mp4')  # generic failure
// after
clean = [str(p) for p in (a, b) if p and os.path.isfile(str(p))]
service.concat_videos(clean, 'out.mp4')
Defensive patterns

Strategy: try-catch

Validate before calling

videos = [str(v) for v in videos if v and os.path.isfile(str(v))]
if not videos:
    raise ValueError('no valid inputs after filtering')

Type guard

def all_str_paths(videos: object) -> bool:
    return isinstance(videos, list) and all(isinstance(v, str) for v in videos)

Try / catch

try:
    service.concat_videos(videos, out)
except RuntimeError as e:
    if 'Failed to concatenate videos' in str(e):
        logger.exception('unexpected concat failure')  # underlying exception type is in message/log
    else:
        raise

Prevention

When it happens

Trigger: Non-subprocess failures during concat: unreadable files raising OSError, None/invalid entries in the videos list breaking string formatting, disk full during output write, unexpected library exceptions.

Common situations: Passing Path objects or None mixed into the list; disk quota exceeded on long encodes; filesystem errors on network mounts; bugs in calling code that corrupts the input list mid-flight.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/e5dcc031c7e94197. Report an issue: GitHub.