# get_media_from_path

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/media_utils/get_media_from_path)

Try to load a file as an image first, then as a video.

## Signature

```python
get_media_from_path(
    path: pathlib.Path,
) -> ImageData | VideoData | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `pathlib.Path` | Yes | Path to the media file. |

## Returns

`ImageData | VideoData | None`

`ImageData` or `VideoData` if the file is valid media, otherwise `None`.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/ead1d09c7b5c2fe58044917bd7bfbb11634d55e2/libs/cli/deepagents_cli/media_utils.py#L260)