deepfakes/faceswap · error · FaceswapError

Video file '{self._video_file}' cannot be processed. Missing

Error message

Video file '{self._video_file}' cannot be processed. Missing duration metadata

What it means

Raised by MovManager/_get_stream in lib/video.py when the first video stream of the container reports a None time_base. Without a time base, timestamps cannot be converted to seconds, so any duration/seek computation is impossible; Faceswap refuses the file rather than producing garbage timings.

Source

Thrown at lib/video.py:281

        Parameters
        ----------
        container
            The opened video container

        Returns
        -------
        stream
            The first video stream within the container with AUTO threading mode set

        Raises
        ------
        FaceswapError
            If time_base is not stored within the stream
        """
        stream = container.streams.video[self._stream_index]
        stream.thread_type = "AUTO"
        if stream.time_base is None:
            raise FaceswapError(f"Video file '{self._video_file}' cannot be processed. Missing "
                                "duration metadata")
        return stream

    def _get_duration(self) -> int:
        """Obtain the duration of the video, in seconds. First attempt to obtain it from the
        stream. If this does not exist attempt to obtain it from the container. If this also
        does not exist, raise an error

        Parameters
        ----------
        stream
            The stream to attempt to obtain the duration from

        Returns
        -------
        The duration of the stream in seconds

        Raises

View on GitHub (pinned to f530cb7508)

Solutions

  1. Repair/remux the file with ffmpeg: ffmpeg -i broken.mp4 -c copy fixed.mp4, then use the fixed file.
  2. Re-download or re-record the source if remuxing fails.
  3. If the file plays in a player, extract to images first (or a clean intermediate) and feed those to Faceswap instead.

Example fix

# before
faceswap extract -i broken.mp4 ...

# after (shell)
ffmpeg -i broken.mp4 -c copy fixed.mp4
faceswap extract -i fixed.mp4 ...
Defensive patterns

Strategy: validation

Validate before calling

import av
with av.open(video_file) as c:
    s = c.streams.video[0]
    assert s.time_base is not None, "stream lacks time_base; remux the file first"

Prevention

When it happens

Trigger: Opening (av.open) a truncated, corrupted, or non-standard container whose stream metadata lacks time_base — e.g. a partially downloaded file, a broken remux, or a raw stream dumped without proper container headers.

Common situations: Incomplete downloads or interrupted recordings; files produced by buggy muxers; live-stream captures with malformed headers.

Related errors


AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15). Data as JSON: /api/errors/ecaded4a0d49bdad. Report an issue: GitHub.