Skip to content
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

Missing first seconds of audio when playing two way audio #1008

Open
blanknam3d opened this issue Mar 19, 2024 · 7 comments
Open

Missing first seconds of audio when playing two way audio #1008

blanknam3d opened this issue Mar 19, 2024 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@blanknam3d
Copy link

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.

@AlexxIT AlexxIT added the bug Something isn't working label Apr 22, 2024
@AlexxIT AlexxIT self-assigned this Apr 22, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 22, 2024

I'll check on my camera. Maybe the 1-second problem can be fixed.

@AlexxIT AlexxIT changed the title FFmpeg options for 2-way audio sources? Missing first seconds of audio when playing two way audio May 24, 2024
@AlexxIT AlexxIT added this to the v1.9.3 milestone May 24, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented May 24, 2024

It was a really hard task...

@AlexxIT
Copy link
Owner

AlexxIT commented Jun 6, 2024

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

@AlexxIT AlexxIT closed this as completed Jun 6, 2024
@blanknam3d
Copy link
Author

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://PASSWORD@192.168.0.xx
  livingroom: tapo://PASSWORD@192.168.0.xx

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.

@AlexxIT
Copy link
Owner

AlexxIT commented Jun 7, 2024

You should now use audio: auto. But I will check old version. It shouldn't break.

@AlexxIT AlexxIT reopened this Jun 7, 2024
@blanknam3d
Copy link
Author

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.

@blanknam3d
Copy link
Author

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

IMG_4983.mp4
IMG_4984.mp4
IMG_4985.mp4

testsnd.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants