mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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
|
# Create output on first segment
|
||||||
if not output:
|
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(
|
output = av.open(
|
||||||
self.video_path + ".tmp",
|
self.video_path + ".tmp",
|
||||||
"w",
|
"w",
|
||||||
format=RECORDER_CONTAINER_FORMAT,
|
format=RECORDER_CONTAINER_FORMAT,
|
||||||
container_options={
|
container_options=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
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add output streams if necessary
|
# Add output streams if necessary
|
||||||
|
@ -164,11 +164,7 @@ class StreamMuxer:
|
|||||||
av.audio.stream.AudioStream | None,
|
av.audio.stream.AudioStream | None,
|
||||||
]:
|
]:
|
||||||
"""Make a new av OutputContainer and add output streams."""
|
"""Make a new av OutputContainer and add output streams."""
|
||||||
container = av.open(
|
container_options: dict[str, str] = {
|
||||||
memory_file,
|
|
||||||
mode="w",
|
|
||||||
format=SEGMENT_CONTAINER_FORMAT,
|
|
||||||
container_options={
|
|
||||||
# Removed skip_sidx - see:
|
# Removed skip_sidx - see:
|
||||||
# https://github.com/home-assistant/core/pull/39970
|
# https://github.com/home-assistant/core/pull/39970
|
||||||
# "cmaf" flag replaces several of the movflags used,
|
# "cmaf" flag replaces several of the movflags used,
|
||||||
@ -220,7 +216,12 @@ class StreamMuxer:
|
|||||||
if self._stream_settings.ll_hls
|
if self._stream_settings.ll_hls
|
||||||
else {}
|
else {}
|
||||||
),
|
),
|
||||||
},
|
}
|
||||||
|
container = av.open(
|
||||||
|
memory_file,
|
||||||
|
mode="w",
|
||||||
|
format=SEGMENT_CONTAINER_FORMAT,
|
||||||
|
container_options=container_options,
|
||||||
)
|
)
|
||||||
output_vstream = container.add_stream(template=input_vstream)
|
output_vstream = container.add_stream(template=input_vstream)
|
||||||
# Check if audio is requested
|
# Check if audio is requested
|
||||||
|
Loading…
x
Reference in New Issue
Block a user