Skip to content

Commit 4ca0830

Browse files
committed
Types and docstring cleanup
1 parent dc09c57 commit 4ca0830

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

poseinterface/io.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Functions to convert annotations and videos to PoseInterface format."""
2+
13
import copy
24
import json
35
import logging
@@ -294,8 +296,8 @@ def video_to_poseinterface(
294296
return output_video
295297

296298

297-
def _check_ffmpeg():
298-
"Check FFMPEG availability"
299+
def _check_ffmpeg() -> None:
300+
"""Check FFMPEG availability."""
299301
sio.set_default_video_plugin("ffmpeg")
300302
if not _is_ffmpeg_available():
301303
raise RuntimeError("ffmpeg is required but not found")
@@ -322,21 +324,24 @@ def _needs_reencoding(input_video_path: str | Path) -> bool:
322324
return False
323325

324326

325-
def _get_codec_pixelformat(input_video_path: str | Path) -> dict:
327+
def _get_codec_pixelformat(input_video_path: str | Path) -> dict[str, str]:
326328
"""Get video encoding parameters as dictionary.
327329
328-
It wraps sleap-io's _get_video_encoding_info, which
329-
uses `ffmpeg -i` to extract metadata without requiring ffprobe in PATH.
330-
331-
`_get_video_encoding_info` returns a VideoEncodingInfo object
332-
with attributes:
333-
codec: Video codec name (e.g., "h264", "hevc").
334-
codec_profile: Codec profile (e.g., "Main", "High").
335-
pixel_format: Pixel format (e.g., "yuv420p").
336-
bitrate_kbps: Bitrate in kilobits per second.
337-
fps: Frames per second.
338-
gop_size: Group of pictures size (keyframe interval).
339-
container: Container format (e.g., "mov", "avi").
330+
It wraps sleap-io's `_get_video_encoding_info`, which
331+
uses `ffmpeg -i` to extract metadata without requiring
332+
`ffprobe` to be in PATH.
333+
334+
Notes
335+
-----
336+
`_get_video_encoding_info` returns a `VideoEncodingInfo`
337+
object with the following attributes:
338+
- codec: Video codec name (e.g., "h264", "hevc").
339+
- codec_profile: Codec profile (e.g., "Main", "High").
340+
- pixel_format: Pixel format (e.g., "yuv420p").
341+
- bitrate_kbps: Bitrate in kilobits per second.
342+
- fps: Frames per second.
343+
- gop_size: Group of pictures size (keyframe interval).
344+
- container: Container format (e.g., "mov", "avi").
340345
341346
"""
342347
info = _get_video_encoding_info(input_video_path)

0 commit comments

Comments
 (0)