Skip to content

Commit

Permalink
Make pix_fmt optional
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBlue committed Nov 28, 2023
1 parent 2ca0e98 commit a357fdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions auto_editor/ffwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def pipe(self, cmd: list[str]) -> str:
return output


@dataclass(slots=True)
@dataclass(slots=True, frozen=True)
class VideoStream:
width: int
height: int
Expand All @@ -135,7 +135,7 @@ class VideoStream:
duration: float
sar: Fraction
time_base: Fraction
pix_fmt: str
pix_fmt: str | None
color_range: str | None
color_space: str | None
color_primaries: str | None
Expand All @@ -144,7 +144,7 @@ class VideoStream:
lang: str | None


@dataclass(slots=True)
@dataclass(slots=True, frozen=True)
class AudioStream:
codec: str
samplerate: int
Expand All @@ -154,14 +154,14 @@ class AudioStream:
lang: str | None


@dataclass(slots=True)
@dataclass(slots=True, frozen=True)
class SubtitleStream:
codec: str
ext: str
lang: str | None


@dataclass(slots=True)
@dataclass(slots=True, frozen=True)
class FileInfo:
path: Path
bitrate: int
Expand Down Expand Up @@ -208,7 +208,7 @@ def initFileInfo(path: str, ffmpeg: FFmpeg, log: Log, label: str = "") -> FileIn

for i, v in enumerate(cont.streams.video):
vdur = 0.0
if hasattr(v, "duration") and v.duration is not None:
if v.duration is not None and v.time_base is not None:
vdur = float(v.duration * v.time_base)

fps = v.average_rate
Expand Down
2 changes: 1 addition & 1 deletion auto_editor/subcommands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class VideoJson(TypedDict):
aspect_ratio: list[int]
pixel_aspect_ratio: str
duration: float
pix_fmt: str
pix_fmt: str | None
color_range: str | None
color_space: str | None
color_primaries: str | None
Expand Down

0 comments on commit a357fdf

Please sign in to comment.