Skip to content

Commit a339652

Browse files
committed
added BlackFrame subclass: BlackFrames
1 parent 15d77db commit a339652

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/ffmpegio/analyze.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ class BlackFrame(MetadataLogger):
424424
media_type = "video" # the stream media type
425425
meta_names = ("blackframe",) # metadata primary names
426426
filter_name = "blackframe"
427-
Output = namedtuple("BlackFrames", ["time", "pblack"])
427+
428+
class BlackFrames(NamedTuple):
429+
time: List[float | int] #: timestamp in seconds, frames, or pts
430+
pblack: List[int] #: percentage of black pixels
428431

429432
def __init__(self, **options):
430433
self.options = options
@@ -453,8 +456,9 @@ def log(self, t: float | int, name: str, key: Optional[str], value: str):
453456
self.frames.append((t, int(value)))
454457

455458
@property
456-
def output(self):
457-
return self.Output(*zip(*self.frames))
459+
def output(self) -> BlackFrames:
460+
"""log output"""
461+
return self.BlackFrames(*zip(*self.frames))
458462

459463

460464
class FreezeDetect(MetadataLogger):

0 commit comments

Comments
 (0)