core: FFMPEG Unknown encoder TTS to Speaker
The problem
Since 2023.6 it seems all TTS media playing has broken when going to a unifi protect speaker. TTS works fine in browser and on my android device but attempting to play to a unifi protect speaker no longer works. Its unclear to me if this is a unifi protect issue though or an HA issue.
I saw the thread here, https://github.com/home-assistant/core/issues/93534 which mentioned it wasnt protect related so perhaps this effects other speakers as well.
Not trying to reopen it as I understand its a different issue but not clear to me why this suddenly broke as it was working in prior versions. Unless Homeassistant is now including ffmpeg without --enable-nonfree set which seems like breaking change not mentioned anywhere
What version of Home Assistant Core has the issue?
core-2023.6.1
What was the last working version of Home Assistant Core?
core-2023.5.X
What type of installation are you running?
Home Assistant OS
Integration causing the issue
No response
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
[139741893108304] Error while playing audio (ffmpeg): [mp3 @ 0x7f68a366b000] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'https://XXXXXXXXXXX/api/tts_proxy/640ab2bae07bedc4c163f679a746f7ab7fb5d1fa_en-us_-_google_translate.mp3': Metadata: Text : Test Duration: 00:00:00.86, start: 0.000000, bitrate: 42 kb/s Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s [aost#0:0 @ 0x7f68a36ac100] Unknown encoder 'AudioCodecs.AAC' [mp3 @ 0x7f298486b000] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'https://XXXXXXXXXXXXX/api/tts_proxy/e2d0a343442ba7bd2c0537659a05e61668575f2b_en-us_-_google_translate.mp3': Metadata: Text : en-us Duration: 00:00:02.59, start: 0.000000, bitrate: 35 kb/s Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s [aost#0:0 @ 0x7f29848ac100] Unknown encoder 'AudioCodecs.AAC' [mp3 @ 0x7fe2f446b000] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'https://XXXXXXXXXX/api/tts_proxy/e2d0a343442ba7bd2c0537659a05e61668575f2b_en-us_-_google_translate.mp3': Metadata: Text : en-us Duration: 00:00:02.59, start: 0.000000, bitrate: 35 kb/s Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s [aost#0:0 @ 0x7fe2f44ac100] Unknown encoder 'AudioCodecs.AAC' [mp3 @ 0x7fe25e06b000] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'https://XXXXXXXXXXXXX/api/tts_proxy/e2d0a343442ba7bd2c0537659a05e61668575f2b_en-us_-_google_translate.mp3': Metadata: Text : en-us Duration: 00:00:02.59, start: 0.000000, bitrate: 35 kb/s Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s [aost#0:0 @ 0x7fe25e0ac100] Unknown encoder 'AudioCodecs.AAC' Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'https://XXXXXXXXXXXX/api/tts_proxy/e2d0a343442ba7bd2c0537659a05e61668575f2b_en-us_22597d2fbc_tts.piper.wav': Duration: 00:00:02.18, bitrate: 256 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, 1 channels, s16, 256 kb/s [aost#0:0 @ 0x7f1f5c0ac100] Unknown encoder 'AudioCodecs.AAC' Guessed Channel Layout for Input Stream #0.0 : mono Input #0, wav, from 'https://XXXXXXXXXXXX/api/tts_proxy/e2d0a343442ba7bd2c0537659a05e61668575f2b_en-us_22597d2fbc_tts.piper.wav': Duration: 00:00:02.18, bitrate: 256 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, 1 channels, s16, 256 kb/s [aost#0:0 @ 0x7f4142eac100] Unknown encoder 'AudioCodecs.AAC'
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (1 by maintainers)
Since this is actually an issue with logs from HA OS (the original issue was for HA Core on MacOS), I did more digging and testing. It looks like this is a Python 3.11 breaking change, not anything to do with ffmpeg or HA Core. Python 3.11 had a breaking change without how enums are handled.
The dev environment for HA Core is still using Python 3.10 which is how I missed it originally, but I was able to reproduce it using the official Python images and Debian bookworm images as well.
@starsoccer, you can close the docker-base issue. I will get it fixed and worked out.
Feel free to do it. Probably need some more work…. I didn’t look to much to see what each FFMpeg argument does I was just interested to see if the codec requirement was needed.
I have other media players and they all work fine. This is an issue for https://github.com/AngellusMortis/pyunifiprotect calling the aac encoder in ffmpeg command I changed the cmd in stream.py to
and it seems to work for me.