go2rtc
go2rtc copied to clipboard
Missing first seconds of audio when playing two way audio
Forgive me for perhaps being a bit naive here... I'm currently using Tapo C200 cameras, I got 2-way audio working, however when the cameras play the audio sent to them they miss the first second or so of audio. Given that the cameras are only playing 8khz audio, I figure that's simply a result of the camera's hardware limits & not a fault of go2rtc.
Is it possible to set FFmpeg options for only audio streamed to the cameras, so I could add a short 1 second of silence in the audio sent to the cameras? I've read through just about all the documentation & I'm not sure how I could do so, though I'm also the kind of person to miss the obvious solution after reading it several times. I don't want to add any delay in audio or video from the cameras, just the audio streamed to them.
I'll check on my camera. Maybe the 1-second problem can be fixed.
It was a really hard task...
Should be fixed when using audio codec auto
. This is special case with auto select best codec and fixing missing first seconds of audio.
https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.3
It seems something else that was changed in the update might've broken the ability to play back audio files through Home Assistant... Previously this worked, however in 1.9.3, this seems to have stopped working suddenly. Two-way audio with a video+audio stream over HTTPS still works fine, however I can no longer play audio files to the cameras locally after updating to 1.9.3.
In my HAss configuration.yaml:
media_player:
- platform: webrtc
entity_id: media_player.lrtapo
name: Livingroom Camera
stream: lrtapo
audio: pcma
- platform: webrtc
entity_id: media_player.kitapo
name: Kitchen Camera
stream: kitapo
audio: pcma
go2rtc configuration:
streams:
kitchen: tapo://[email protected]
livingroom: tapo://[email protected]
Is there something I'm doing wrong, or was something else changed? Searched other issues pretty extensively & read through both README's for WebRTC and go2rtc, not sure what isn't right with how I've configured the virtual media players.
You should now use audio: auto
. But I will check old version. It shouldn't break.
I changed audio: pcma
to audio: auto
on both - it appears as if audio is actually playing on them in Home Assistant's UI, however nothing is actually played from the camera's speaker, in spite of the UI making it appear as if audio is playing on them. Both cameras are running firmware ver 1.3.7.
Finally had a chance to test with the 1.9.4 release. That seemed to fix it so audio: auto
in my Home Assistant config works now, haven't tried with audio: pcma
set though.
That being said, though it seems the original issue has been mitigated somewhat, it still occurs to some extent. It seems the audio that's cut off at the start is lesser than it used to be, however it still cuts off some audio. It also still sometimes cuts off the tail end, though for most of my uses that's not a noticeable problem - most audio I send to the camera has at least a half-second tail anyway.
A few videos to demonstrate with one of my cameras + the original 13s audio file sent to the camera for ref (a short music loop I made, used as it has no copyright):
https://github.com/AlexxIT/go2rtc/assets/25239471/efa5bfee-431e-431d-9633-48dd4fb396f2
https://github.com/AlexxIT/go2rtc/assets/25239471/0d1ca815-67c9-4af2-87c2-33d4f6f437b9
https://github.com/AlexxIT/go2rtc/assets/25239471/04173ce7-2deb-4ac2-84d0-e8745d7aa714