Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 7cd6a57

Browse files
committed
misc: Update docs
1 parent 4d8314b commit 7cd6a57

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

PyCriCodecsEx/usm.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def AudioMask(self, memObj: bytearray) -> bytearray:
150150
# are still unknown how to derive them, at least video wise it is possible, no idea how it's calculated audio wise nor anything else
151151
# seems like it could be random values and the USM would still work.
152152
class FFmpegCodec:
153+
"""Base codec for FFMpeg-based Video streams"""
153154
filename: str
154155
filesize: int
155156

@@ -232,7 +233,7 @@ def frame_count(self):
232233
return len(self.packets)
233234

234235
def frames(self):
235-
"""frame data, frame dict, is keyframe, duration"""
236+
"""Generator of [frame data, frame dict, is keyframe, duration]"""
236237
offsets = [int(packet["pos"]) for packet in self.packets] + [self.filesize]
237238
for i, frame in enumerate(self.packets):
238239
frame_size = offsets[i + 1] - offsets[i]
@@ -290,13 +291,16 @@ def generate_SFV(self, builder: "USMBuilder"):
290291
return SFV_list
291292

292293
def save(self, filepath: str):
293-
'''Saves the raw, underlying video stream to a file.'''
294+
'''Saves the underlying video stream to a file.'''
294295
tell = self.file.tell()
295296
self.file.seek(0)
296297
shutil.copyfileobj(self.file, open(filepath, 'wb'))
297298
self.file.seek(tell)
298299

299300
class VP9Codec(FFmpegCodec):
301+
"""VP9 Video stream codec.
302+
303+
Only streams with `.ivf` containers are supported."""
300304
MPEG_CODEC = 9
301305
MPEG_DCPREC = 0
302306
VERSION = 16777984
@@ -305,6 +309,9 @@ def __init__(self, filename: str | bytes):
305309
super().__init__(filename)
306310
assert self.format == "ivf", "must be ivf format."
307311
class H264Codec(FFmpegCodec):
312+
"""H264 Video stream codec.
313+
314+
Only streams with `.h264` containers are supported."""
308315
MPEG_CODEC = 5
309316
MPEG_DCPREC = 11
310317
VERSION = 0
@@ -315,6 +322,9 @@ def __init__(self, filename : str | bytes):
315322
self.format == "h264"
316323
), "must be raw h264 data. transcode with '.h264' suffix as output"
317324
class MPEG1Codec(FFmpegCodec):
325+
"""MPEG1 Video stream codec.
326+
327+
Only streams with `.mpeg1` containers are supported."""
318328
MPEG_CODEC = 1
319329
MPEG_DCPREC = 11
320330
VERSION = 0

0 commit comments

Comments
 (0)