-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Disable audio for HLS or mpegts input #39906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable audio for HLS or mpegts input #39906
Conversation
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"}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably the easiest way to do it. I am not sure if "hls" and "mpegts" are the names that are returned for those inputs. I do know that "rtsp" is what is returned for a rtsp input. We could change the check to (container.format.name != "rtsp") instead.
Also, we could just disable the output audio stream for fmp4 instead of disabling the input audio stream. This would allow the recorder to still get audio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the recorder will probably have the same problem (muxing to mp4). This is fine for now, assuming it works :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't think it would because we aren't setting the empty_moov flag on the recorder segments, so the bitstream filter would be automatically applied. But the lookback segments come from the hls segments, and those would have no audio stream...messy.
I agree best to keep it simple especially if it's not a long term solution anyway.
@cgtobi - Can you test this branch for your Netatmo camera? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Proposed change
Muxing aac audio from an HLS/mpegts input into an mp4 output requires the use of the aac_adtstoasc bitstream filter. Normally ffmpeg will enable this automatically, but this is incompatible with the flag empty_moov we use to create fmp4 segments. As of now there is no way to apply the bitstream filters through PyAV, so for now we will disable audio when we detect these problematic input types.
Type of change
Example entry for
configuration.yaml
:# Example configuration.yaml
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: