<!-- # hard line break macro for HTML -->

# fiftyone.core.media

Sample media utilities.

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Functions:**

| [`get_media_type`](#fiftyone.core.media.get_media_type)(filepath)   | Gets the media type for the given filepath.   |
|---------------------------------------------------------------------|-----------------------------------------------|

**Exceptions:**

| [`MediaTypeError`](#fiftyone.core.media.MediaTypeError)                                          | Exception raised when a problem with media types is encountered.                                                     |
|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| [`SelectGroupSlicesError`](#fiftyone.core.media.SelectGroupSlicesError)([supported_media_types]) | Exception raised when a grouped collection is passed to a method that expects a primitive media type to be selected. |

### fiftyone.core.media.get_media_type(filepath)

Gets the media type for the given filepath.

* **Parameters:**
  **filepath** – a filepath
* **Returns:**
  the media type

### *exception* fiftyone.core.media.MediaTypeError

Bases: `TypeError`

Exception raised when a problem with media types is encountered.

**Methods:**

| [`add_note`](#fiftyone.core.media.MediaTypeError.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.media.MediaTypeError.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.media.MediaTypeError.args)   |    |
|------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

### *exception* fiftyone.core.media.SelectGroupSlicesError(supported_media_types=None)

Bases: `ValueError`

Exception raised when a grouped collection is passed to a method that
expects a primitive media type to be selected.

* **Parameters:**
  **supported_media_types** (*None*) – an optional media type or iterable of
  media types that are supported

**Methods:**

| [`add_note`](#fiftyone.core.media.SelectGroupSlicesError.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.media.SelectGroupSlicesError.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.media.SelectGroupSlicesError.args)   |    |
|--------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.
