cutcutcodec.core.analysis.video.properties.pix_fmt.get_pix_fmt
- cutcutcodec.core.analysis.video.properties.pix_fmt.get_pix_fmt(filename: Path | str | bytes, index: int = 0, *, backend: str | None = None) str[source]
Read in the metadata, the pixel format.
Parameters
- filenamepathlike
The pathlike of the file containing a video stream.
- indexint
The relative index of the video stream being considered, by default the first stream encountered is selected.
- backendstr, optional
None (default) : Try to read the stream by trying differents backends.
- ‘ffmpeg’Uses the modules
pip install ffmpeg-python which are using the
ffmpegprogram in the background.
- ‘ffmpeg’Uses the modules
‘cv2’ : Uses the module
pip install opencv-contrib-python-headless.
Returns
- pix_fmtint
The name of the pixel format.
Raises
- MissingStreamError
If the file does not contain a playable video stream.
- MissingInformation
If the information is unavailable.
Examples
>>> from cutcutcodec.core.analysis.video.properties.pix_fmt import get_pix_fmt >>> from cutcutcodec.utils import get_project_root >>> media = get_project_root() / "media" / "video" / "intro.webm" >>> get_pix_fmt(media) 'yuv420p' >>>