Fix recording duration flag (#34648)
parent
77443b3d09
commit
40d3d64027
|
@ -2,7 +2,7 @@
|
|||
"domain": "stream",
|
||||
"name": "Stream",
|
||||
"documentation": "https://www.home-assistant.io/integrations/stream",
|
||||
"requirements": ["av==6.1.2"],
|
||||
"requirements": ["av==7.0.1"],
|
||||
"dependencies": ["http"],
|
||||
"codeowners": ["@hunterjm"],
|
||||
"quality_scale": "internal"
|
||||
|
|
|
@ -17,7 +17,8 @@ def async_setup_recorder(hass):
|
|||
|
||||
def recorder_save_worker(file_out: str, segments: List[Segment]):
|
||||
"""Handle saving stream."""
|
||||
output = av.open(file_out, "w", options={"movflags": "frag_keyframe"})
|
||||
first_pts = None
|
||||
output = av.open(file_out, "w")
|
||||
output_v = None
|
||||
|
||||
for segment in segments:
|
||||
|
@ -29,13 +30,22 @@ def recorder_save_worker(file_out: str, segments: List[Segment]):
|
|||
# Add output streams
|
||||
if not output_v:
|
||||
output_v = output.add_stream(template=source_v)
|
||||
context = output_v.codec_context
|
||||
context.flags |= "GLOBAL_HEADER"
|
||||
|
||||
# Remux video
|
||||
for packet in source.demux(source_v):
|
||||
if packet is not None and packet.dts is not None:
|
||||
if first_pts is None:
|
||||
first_pts = packet.pts
|
||||
|
||||
packet.pts -= first_pts
|
||||
packet.dts -= first_pts
|
||||
packet.stream = output_v
|
||||
output.mux(packet)
|
||||
|
||||
source.close()
|
||||
|
||||
output.close()
|
||||
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ atenpdu==0.3.0
|
|||
aurorapy==0.2.6
|
||||
|
||||
# homeassistant.components.stream
|
||||
av==6.1.2
|
||||
av==7.0.1
|
||||
|
||||
# homeassistant.components.avea
|
||||
avea==1.4
|
||||
|
|
|
@ -126,7 +126,7 @@ arcam-fmj==0.4.3
|
|||
async-upnp-client==0.14.13
|
||||
|
||||
# homeassistant.components.stream
|
||||
av==6.1.2
|
||||
av==7.0.1
|
||||
|
||||
# homeassistant.components.axis
|
||||
axis==25
|
||||
|
|
Loading…
Reference in New Issue