mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix recording duration flag (#34648)
This commit is contained in:
parent
77443b3d09
commit
40d3d64027
@ -2,7 +2,7 @@
|
|||||||
"domain": "stream",
|
"domain": "stream",
|
||||||
"name": "Stream",
|
"name": "Stream",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/stream",
|
"documentation": "https://www.home-assistant.io/integrations/stream",
|
||||||
"requirements": ["av==6.1.2"],
|
"requirements": ["av==7.0.1"],
|
||||||
"dependencies": ["http"],
|
"dependencies": ["http"],
|
||||||
"codeowners": ["@hunterjm"],
|
"codeowners": ["@hunterjm"],
|
||||||
"quality_scale": "internal"
|
"quality_scale": "internal"
|
||||||
|
@ -17,7 +17,8 @@ def async_setup_recorder(hass):
|
|||||||
|
|
||||||
def recorder_save_worker(file_out: str, segments: List[Segment]):
|
def recorder_save_worker(file_out: str, segments: List[Segment]):
|
||||||
"""Handle saving stream."""
|
"""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
|
output_v = None
|
||||||
|
|
||||||
for segment in segments:
|
for segment in segments:
|
||||||
@ -29,13 +30,22 @@ def recorder_save_worker(file_out: str, segments: List[Segment]):
|
|||||||
# Add output streams
|
# Add output streams
|
||||||
if not output_v:
|
if not output_v:
|
||||||
output_v = output.add_stream(template=source_v)
|
output_v = output.add_stream(template=source_v)
|
||||||
|
context = output_v.codec_context
|
||||||
|
context.flags |= "GLOBAL_HEADER"
|
||||||
|
|
||||||
# Remux video
|
# Remux video
|
||||||
for packet in source.demux(source_v):
|
for packet in source.demux(source_v):
|
||||||
if packet is not None and packet.dts is not None:
|
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
|
packet.stream = output_v
|
||||||
output.mux(packet)
|
output.mux(packet)
|
||||||
|
|
||||||
|
source.close()
|
||||||
|
|
||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ atenpdu==0.3.0
|
|||||||
aurorapy==0.2.6
|
aurorapy==0.2.6
|
||||||
|
|
||||||
# homeassistant.components.stream
|
# homeassistant.components.stream
|
||||||
av==6.1.2
|
av==7.0.1
|
||||||
|
|
||||||
# homeassistant.components.avea
|
# homeassistant.components.avea
|
||||||
avea==1.4
|
avea==1.4
|
||||||
|
@ -126,7 +126,7 @@ arcam-fmj==0.4.3
|
|||||||
async-upnp-client==0.14.13
|
async-upnp-client==0.14.13
|
||||||
|
|
||||||
# homeassistant.components.stream
|
# homeassistant.components.stream
|
||||||
av==6.1.2
|
av==7.0.1
|
||||||
|
|
||||||
# homeassistant.components.axis
|
# homeassistant.components.axis
|
||||||
axis==25
|
axis==25
|
||||||
|
Loading…
x
Reference in New Issue
Block a user