Disable audio for HLS or mpegts input (#39906)

This commit is contained in:
uvjustin 2020-09-11 03:55:55 +08:00 committed by Paulus Schoutsen
parent 7eade4029a
commit b0b9579778

View File

@ -64,11 +64,16 @@ def _stream_worker_internal(hass, stream, quit_event):
video_stream = container.streams.video[0]
except (KeyError, IndexError):
_LOGGER.error("Stream has no video")
container.close()
return
try:
audio_stream = container.streams.audio[0]
except (KeyError, IndexError):
audio_stream = None
# These formats need aac_adtstoasc bitstream filter, but auto_bsf not
# compatible with empty_moov and manual bitstream filters not in PyAV
if container.format.name in {"hls", "mpegts"}:
audio_stream = None
# The presentation timestamps of the first packet in each stream we receive
# Use to adjust before muxing or outputting, but we don't adjust internally
@ -238,7 +243,7 @@ def _stream_worker_internal(hass, stream, quit_event):
# Update last_dts processed
last_dts[packet.stream] = packet.dts
# mux video packets immediately, save audio packets to be muxed all at once
# mux packets
if packet.stream == video_stream:
mux_video_packet(packet) # mutates packet timestamps
else: