Skip to content

Fix RTSP AAC audio from very buggy noname camera #1328

@itsolon

Description

@itsolon

First of all im sure im doing something wrong, but i spent days with that issue im facing and think i need help.

whats happened
months ago i connected a camera (noname PTZ) 4K with homeassistant and installed frigate addon.
cam has 4K video with h264, and g711a or g711u audio sample rate 8000khz

the config looked like this:

go2rtc:
  streams:
    mycam:
      - rtsp://myuser:mypass@192.168.91.20:554/stream1#timeout=10  #timeout is neccessary because cam needs that time      
      - ffmpeg:mycam#audio=aac
    mycam_s:
      - rtsp://myuser:mypass@192.168.91.20:554/stream0#timeout=10
      - ffmpeg:mycam_s#audio=aac
cameras:
  mycam-Cam:
    enabled: true
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/mycam
          input_args: preset-rtsp-restream
          roles:
            - record
            - audio
        - path: rtsp://127.0.0.1:8554/mycam_s
          input_args: preset-rtsp-restream
          roles:
            - detect

this configuration works, you might ask why then rising an issue? i will tell you
i was satisfied with the picture but audio seemed to bad, and therefore i found that i can adjust aac 16000
audio
the audio plays well inside vlc player
but when i use go2rtc then the stream doesnt start and throws errors

then i realized that the transcoding from g711u to aac worked,
but transcoding from aac to aac is not neccessary and can be stripped out of the config
but the go2rtc at myip:1984 portal is working but the stream cannot be shown in edge or chrome
no audio

i tried different syntax to transcode from aac16000 to 8000 because i thought it might help with my cam to show the stream inside the website and so inside the frigate app too.

the question is:
how can i tell via syntax that i need waiting time 10 seconds?
#timeout=10
how can i convert the video with for example

      - ffmpeg:rtsp://myip:554/stream0?username=myuser&password=mypass#timeout=10#video=h264#audio=aac/16000#hardware

GOAL:
i want to have aac inside my streams because of the better audio quality, if needed i transcode the audio so that the go2rtc can better handle it.

Type
error
Timestamp
2024-08-29 07:16:04
Tag
exec
Message

timeout source="exec:ffmpeg -hide_banner -v error -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_flags allow_profile_mismatch -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://127.0.0.1:8554/einfahrt?video&audio -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0 -c:a aac -ar:a 16000 -ac:a 1 -vf \"format=vaapi|nv12,hwupload,scale_vaapi=out_color_matrix=bt709:out_range=tv:format=nv12\" -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/b52fff96b92896dbbcf3d0381d80

onlycircle

go2rtc:
  streams:
    einfahrt:
      - rtsp://myip:554/stream0?username=admin&password=JZ49WrmzX7cm#timeout=10
      - ffmpeg:einfahrt#video=h264#audio=aac/16000#hardware
      - ffmpeg:rtsp://myip:554/stream0?username=myuser&password=mypass#timeout=10#video=h264#audio=aac/16000#hardware

what happens there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions