async def test_h265_video_is_hvc1(hass, record_worker_sync): """Test that a h265 video gets muxed as hvc1.""" await async_setup_component( hass, "stream", { "stream": { CONF_LL_HLS: True, CONF_SEGMENT_DURATION: SEGMENT_DURATION, CONF_PART_DURATION: TEST_PART_DURATION, } }, ) source = generate_h265_video() stream = create_stream(hass, source, {}) # use record_worker_sync to grab output segments with patch.object(hass.config, "is_allowed_path", return_value=True): await stream.async_record("/example/path") complete_segments = list(await record_worker_sync.get_segments())[:-1] assert len(complete_segments) >= 1 segment = complete_segments[0] part = segment.parts[0] av_part = av.open(io.BytesIO(segment.init + part.data)) assert av_part.streams.video[0].codec_tag == "hvc1" av_part.close() await record_worker_sync.join() stream.stop()
async def test_h265_video_is_hvc1(hass, worker_finished_stream): """Test that a h265 video gets muxed as hvc1.""" await async_setup_component( hass, "stream", { "stream": { CONF_LL_HLS: True, CONF_SEGMENT_DURATION: SEGMENT_DURATION, CONF_PART_DURATION: TEST_PART_DURATION, } }, ) source = generate_h265_video() worker_finished, mock_stream = worker_finished_stream with patch("homeassistant.components.stream.Stream", wraps=mock_stream): stream = create_stream(hass, source, {}, stream_label="camera") recorder_output = stream.add_provider(RECORDER_PROVIDER, timeout=30) await stream.start() await worker_finished.wait() complete_segments = list(recorder_output.get_segments())[:-1] assert len(complete_segments) >= 1 segment = complete_segments[0] part = segment.parts[0] av_part = av.open(io.BytesIO(segment.init + part.data)) assert av_part.streams.video[0].codec_tag == "hvc1" av_part.close() await stream.stop() assert stream.get_diagnostics() == { "container_format": "mov,mp4,m4a,3gp,3g2,mj2", "keepalive": False, "start_worker": 1, "video_codec": "hevc", "worker_error": 1, }
async def test_h265_video_is_hvc1(hass, record_worker_sync): """Test that a h265 video gets muxed as hvc1.""" await async_setup_component( hass, "stream", { "stream": { CONF_LL_HLS: True, CONF_SEGMENT_DURATION: SEGMENT_DURATION, CONF_PART_DURATION: TEST_PART_DURATION, } }, ) source = generate_h265_video() stream = create_stream(hass, source, {}, stream_label="camera") # use record_worker_sync to grab output segments with patch.object(hass.config, "is_allowed_path", return_value=True): await stream.async_record("/example/path") complete_segments = list(await record_worker_sync.get_segments())[:-1] assert len(complete_segments) >= 1 segment = complete_segments[0] part = segment.parts[0] av_part = av.open(io.BytesIO(segment.init + part.data)) assert av_part.streams.video[0].codec_tag == "hvc1" av_part.close() await record_worker_sync.join() stream.stop() assert stream.get_diagnostics() == { "container_format": "mov,mp4,m4a,3gp,3g2,mj2", "keepalive": False, "start_worker": 1, "video_codec": "hevc", "worker_error": 1, }