mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Refactor av.open calls to support type annotations (#129688)
This commit is contained in:
parent
bf4922a7ef
commit
f7103da818
@ -105,17 +105,16 @@ class RecorderOutput(StreamOutput):
|
||||
|
||||
# Create output on first segment
|
||||
if not output:
|
||||
container_options: dict[str, str] = {
|
||||
"video_track_timescale": str(int(1 / source_v.time_base)),
|
||||
"movflags": "frag_keyframe+empty_moov",
|
||||
"min_frag_duration": str(self.stream_settings.min_segment_duration),
|
||||
}
|
||||
output = av.open(
|
||||
self.video_path + ".tmp",
|
||||
"w",
|
||||
format=RECORDER_CONTAINER_FORMAT,
|
||||
container_options={
|
||||
"video_track_timescale": str(int(1 / source_v.time_base)),
|
||||
"movflags": "frag_keyframe+empty_moov",
|
||||
"min_frag_duration": str(
|
||||
self.stream_settings.min_segment_duration
|
||||
),
|
||||
},
|
||||
container_options=container_options,
|
||||
)
|
||||
|
||||
# Add output streams if necessary
|
||||
|
@ -164,11 +164,7 @@ class StreamMuxer:
|
||||
av.audio.stream.AudioStream | None,
|
||||
]:
|
||||
"""Make a new av OutputContainer and add output streams."""
|
||||
container = av.open(
|
||||
memory_file,
|
||||
mode="w",
|
||||
format=SEGMENT_CONTAINER_FORMAT,
|
||||
container_options={
|
||||
container_options: dict[str, str] = {
|
||||
# Removed skip_sidx - see:
|
||||
# https://github.com/home-assistant/core/pull/39970
|
||||
# "cmaf" flag replaces several of the movflags used,
|
||||
@ -220,7 +216,12 @@ class StreamMuxer:
|
||||
if self._stream_settings.ll_hls
|
||||
else {}
|
||||
),
|
||||
},
|
||||
}
|
||||
container = av.open(
|
||||
memory_file,
|
||||
mode="w",
|
||||
format=SEGMENT_CONTAINER_FORMAT,
|
||||
container_options=container_options,
|
||||
)
|
||||
output_vstream = container.add_stream(template=input_vstream)
|
||||
# Check if audio is requested
|
||||
|
Loading…
x
Reference in New Issue
Block a user