{"record":{"id":"4833a180d18eb543","repo":"langchain-ai/deepagents","slug":"video-payload-contains-no-video-stream","errorCode":null,"errorMessage":"Video payload contains no video stream","messagePattern":"Video payload contains no video stream","errorType":"exception","errorClass":"VideoExtractionError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/middleware/_video.py","lineNumber":250,"sourceCode":"    errors: list[type[BaseException]] = [OSError]\n    av_error = getattr(av, \"error\", None)\n    for name in (\"FFmpegError\", \"InvalidDataError\"):\n        error_type = getattr(av_error, name, None)\n        if (\n            isinstance(error_type, type)\n            and issubclass(error_type, BaseException)\n            and not any(issubclass(error_type, existing) for existing in errors)\n        ):\n            errors.append(error_type)\n    return tuple(errors)\n\n\ndef _find_video_stream(container: Any) -> Any:  # noqa: ANN401  # PyAV types are unavailable without the [video] extra\n    \"\"\"Return the first video stream in `container` or raise.\"\"\"\n    video_stream = next((s for s in container.streams if s.type == \"video\"), None)\n    if video_stream is None:\n        msg = \"Video payload contains no video stream\"\n        raise VideoExtractionError(msg)\n    return video_stream\n\n\ndef _stream_start_pts(video_stream: Any) -> int:  # noqa: ANN401  # PyAV types are unavailable without the [video] extra\n    \"\"\"Return the stream start timestamp in stream time-base units.\"\"\"\n    start_time = getattr(video_stream, \"start_time\", None)\n    return int(start_time) if start_time is not None else 0\n\n\ndef _stream_start_seconds(video_stream: Any, time_base: float) -> float:  # noqa: ANN401  # PyAV types are unavailable without the [video] extra\n    \"\"\"Return the stream start timestamp in seconds.\"\"\"\n    return _stream_start_pts(video_stream) * time_base\n\n\ndef _frame_seconds(frame: Any, *, time_base: float, stream_start_seconds: float) -> float | None:  # noqa: ANN401  # PyAV types are unavailable without the [video] extra\n    \"\"\"Return a frame timestamp normalized to seconds from the video start.\"\"\"\n    pts = getattr(frame, \"pts\", None)\n    if pts is not None:","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/middleware/_video.py#L232-L268","documentation":"The container opened successfully but contains no stream of type 'video' (only audio, subtitles, data, or nothing). `_find_video_stream` raises `VideoExtractionError` because frame extraction is impossible without a video stream.","triggerScenarios":"Passing an audio-only file (mp3, m4a, wav), a data-only container, or an empty/headers-only file that FFmpeg still manages to open.","commonSituations":"Mixing up audio and video uploads; a .mp4 that is actually an audio track; stripped video streams after transcoding.","solutions":["Confirm the file actually contains a video track (ffprobe should list a video stream)","Point the extraction at the correct file if an audio file was passed by mistake","Catch `VideoExtractionError` and route audio-only files to an audio pipeline","Re-transcode with `ffmpeg -c:v ...` if the source lost its video stream"],"exampleFix":"// before\nframes = extract_video_frames(audio_bytes, offset_seconds=0, duration_seconds=5, sampling_rate=1)\n// after\nprobe = subprocess.run([\"ffprobe\", \"-v\", \"error\", \"-select_streams\", \"v\", \"-show_entries\", \"stream=index\", \"-of\", \"csv\", path])\nif probe.stdout.strip():\n    frames = extract_video_frames(video_bytes, offset_seconds=0, duration_seconds=5, sampling_rate=1)","handlingStrategy":"try-catch","validationCode":"has_video = subprocess.run(\n    [\"ffprobe\", \"-v\", \"error\", \"-select_streams\", \"v:0\", \"-show_entries\", \"stream=codec_type\", \"-of\", \"csv\", path],\n    capture_output=True, text=True,\n).stdout.strip() != \"\"","typeGuard":null,"tryCatchPattern":"try:\n    result = extract_video_frames(content, offset_seconds=0, duration_seconds=10, sampling_rate=1)\nexcept VideoExtractionError as exc:\n    if \"no video stream\" in str(exc):\n        route_to_audio_pipeline(content)\n    result = None","preventionTips":["Route audio-only uploads away from video extraction","Probe streams with ffprobe before processing","Reject empty/headerless files early"],"tags":["video","pyav","missing-stream","audio-only"],"backgroundTag":"no-video-stream","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}