8000 Disable audio for HLS or mpegts input by uvjustin · Pull Request #39906 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged

Conversation

uvjustin
Copy link
Contributor

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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @hunterjm, mind taking a look at this pull request as its been labeled with an integration (stream) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

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"}:
Copy link
Contributor Author

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.

Copy link
Member

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 :)

Copy link
Contributor Author

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.

@hunterjm
Copy link
Member

@cgtobi - Can you test this branch for your Netatmo camera?

@hunterjm hunterjm added this to the 0.115.0 milestone Sep 10, 2020
Copy link
Contributor
@cgtobi cgtobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hunterjm hunterjm merged commit 4ee5a29 into home-assistant:dev Sep 10, 2020
balloob pushed a commit that referenced this pull request Sep 11, 2020
@uvjustin uvjustin deleted the disable-audio-for-hls-input-stream branch November 25, 2020 16:27
@uvjustin uvjustin mentioned this pull request Jun 27, 2022
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stream - Malformed AAC bitstream detected
5 participants
0