{"record":{"id":"42c5277f79b8736c","repo":"Comfy-Org/ComfyUI","slug":"no-video-stream-found-in-file-self-file","errorCode":null,"errorMessage":"No video stream found in file '{self.__file}'","messagePattern":"No video stream found in file '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api/latest/_input_impl/video_types.py","lineNumber":161,"sourceCode":"        if start_time < 0:\n            start_time = max(self._get_raw_duration() + start_time, 0.0)\n        return float(start_time), float(self.__duration)\n\n    def get_dimensions(self) -> tuple[int, int]:\n        \"\"\"\n        Returns the dimensions of the video input.\n\n        Returns:\n            Tuple of (width, height)\n        \"\"\"\n        if isinstance(self.__file, io.BytesIO):\n            self.__file.seek(0)  # Reset the BytesIO object to the beginning\n        with av.open(self.__file, mode='r') as container:\n            for stream in container.streams:\n                if stream.type == 'video':\n                    assert isinstance(stream, av.VideoStream)\n                    return stream.width, stream.height\n        raise ValueError(f\"No video stream found in file '{self.__file}'\")\n\n    def get_bit_depth(self) -> int:\n        if isinstance(self.__file, io.BytesIO):\n            self.__file.seek(0)  # Reset the BytesIO object to the beginning\n        with av.open(self.__file, mode=\"r\") as container:\n            video_stream = container.streams.video[0] if len(container.streams.video) > 0 else None\n            return video_stream_bit_depth(video_stream)\n\n    def get_duration(self) -> float:\n        \"\"\"\n        Returns the duration of the video in seconds.\n\n        Returns:\n            Duration in seconds\n        \"\"\"\n        raw_duration = self._get_raw_duration()\n        if self.__start_time < 0:\n            duration_from_start = min(raw_duration, -self.__start_time)","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api/latest/_input_impl/video_types.py#L143-L179","documentation":"VideoFromFile.get_size opens the file with PyAV and scans container.streams for a stream of type 'video'. If none exists (audio-only file, image file, corrupt container), it raises naming the file. This is a content-shape check on the input, done lazily when dimensions are first requested.","triggerScenarios":"Constructing a VideoInput from a file that contains no video stream — an mp3/m4a/audio-only mp4, a GIF mislabeled, or a file PyAV demuxes but whose streams are all non-video — then calling get_size().","commonSituations":"User feeds an audio file into a video input node; upload validation only checked extension; the file is an HTML error page with media extension.","solutions":["Confirm the file actually contains a video track (ffprobe file) and replace audio-only inputs","Validate at ingest: check container.streams.video is non-empty before constructing downstream inputs","If the file should have video, re-export it from the source editor (the export may have been audio-only)"],"exampleFix":"// before\nvi = VideoFromFile('voiceover.m4a')\nw, h = vi.get_size()  # ValueError\n\n# after\nimport av\nwith av.open('voiceover.m4a') as c:\n    assert c.streams.video, 'input must contain a video stream'\nvi = VideoFromFile('clip.mp4')","handlingStrategy":"validation","validationCode":"import av\nwith av.open(path) as c:\n    if not c.streams.video:\n        raise ValueError(f'{path} has no video stream')","typeGuard":"def has_video_stream(path) -> bool:\n    import av\n    with av.open(path) as c:\n        return len(c.streams.video) > 0","tryCatchPattern":null,"preventionTips":["Validate media files at upload/selection time, not at first property access","Use ffprobe in pipelines to pre-screen inputs"],"tags":["video","pyav","no-video-stream","input-validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}