frigate: [Config Support]: Can't get audio recording to work, ffmpeg errors

Describe the problem you are having

I’m trying to make Frigate record my camera with audio, but I’m having some trouble getting it to work. FFmpeg throw out some errors and exits. The default configuration (no audio) works fine.

The camera audio codec is PCM_ALAW, which isn’t supported in a MP4 container. So the audio must be encoded as AAC. I also tried decreasing the bitrate by adding -b:a 64k to the output_args>record, but that didn’t make any difference.

Version

0.11.0-d2c3cdc

Frigate config file

mqtt:
  host: eclipse-mosquitto
  user: mosquitto
  password: password

database:
  path: /db/frigate.db

logger:
  default: info

detectors:
  cpu1:
    type: cpu
    num_threads: 8

live:
  height: 1080

birdseye:
  mode: continuous

ffmpeg:
  hwaccel_args: -hwaccel qsv -qsv_device /dev/dri/renderD128 -hwaccel_output_format qsv
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac

objects:
  track:
    - person

record:
  enabled: True
  events:
    retain:
      default: 7
      mode: active_objects

cameras:
  lbv141-front:
    ffmpeg:
      inputs:
        - path: rtsp://user:password@192.168.20.187:554/stream1 # <----- 1920x1080
          roles:
            - record
        - path: rtsp://user:password@192.168.20.187:554/stream2 # <----- 640x360
          roles:
            - rtmp
            - detect
    rtmp:
      enabled: True
    detect:
      enabled: True
      width: 640
      height: 360
      fps: 5
    motion:
      mask:
        - 231,29,236,0,0,0,0,30
        - 390,160,364,301,312,297,294,153

Relevant log output

[2022-05-20 10:18:15] detector.cpu1                  INFO    : Starting detection process: 224
[2022-05-20 10:18:15] frigate.app                    INFO    : Output process started: 226
[2022-05-20 10:18:15] frigate.app                    INFO    : Camera processor started for lbv141-front: 230
[2022-05-20 10:18:15] ws4py                          INFO    : Using epoll
[2022-05-20 10:18:15] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-05-20 10:18:15] frigate.app                    INFO    : Capture process started for lbv141-front: 232
[2022-05-20 10:18:15] ws4py                          INFO    : Using epoll
[2022-05-20 10:18:35] ffmpeg.lbv141-front.record     ERROR   : Guessed Channel Layout for Input Stream #0.1 : mono
[2022-05-20 10:18:35] ffmpeg.lbv141-front.record     ERROR   : [aac @ 0x5611990cf980] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
[2022-05-20 10:18:35] ffmpeg.lbv141-front.record     ERROR   : [mp4 @ 0x5611991f8140] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 1024 >= 468
[2022-05-20 10:18:35] ffmpeg.lbv141-front.record     ERROR   : av_interleaved_write_frame(): Invalid argument
[2022-05-20 10:18:35] watchdog.lbv141-front          INFO    : Terminating the existing ffmpeg process...
[2022-05-20 10:18:35] watchdog.lbv141-front          INFO    : Waiting for ffmpeg to exit gracefully...

Frigate stats

{"detection_fps":0.0,"detectors":{"cpu1":{"detection_start":0.0,"inference_speed":33.4,"pid":224}},"lbv141-front":{"camera_fps":5.0,"capture_pid":232,"detection_fps":0.0,"pid":230,"process_fps":5.0,"skipped_fps":0.0},"service":{"latest_version":"0.10.1","storage":{"/dev/shm":{"free":133.3,"mount_type":"tmpfs","total":134.2,"used":0.9},"/media/frigate/clips":{"free":4270.6,"mount_type":"zfs","total":4295.0,"used":24.4},"/media/frigate/recordings":{"free":4270.6,"mount_type":"zfs","total":4295.0,"used":24.4},"/tmp/cache":{"free":996.0,"mount_type":"tmpfs","total":1000.0,"used":4.0}},"temperatures":{},"uptime":825,"version":"0.11.0-d2c3cdc"}}

Operating system

Proxmox

Install method

Docker Compose

Coral version

CPU (no coral)

Any other information that may be helpful

FFprobe output (from Proxmox host, therefore the ffprobe version doesn’t match the version inside the Frigate container, which is 4.4.1-Jellyfin) :

ffprobe version 4.3.4-0+deb11u1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, rtsp, from 'rtsp://user:password@192.168.20.187:554/stream1':
  Metadata:
    title           : Session streamed by "TP-LINK RTSP Server"
    comment         : stream1
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 13.33 tbr, 90k tbn, 30 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 26 (5 by maintainers)

Most upvoted comments

Something seems to be broken with aac encoding. Hopefully this is the same issue several people are reporting. I will see if I can reproduce it.

@hawkeye217 If you could create an issue on jellyfin ffmpeg https://github.com/jellyfin/jellyfin-ffmpeg/issues that would be super helpful. I will be happy to support that issue. Previously since it was only seen with rtsp-simple-server we were unable to create an issue but if you’re just seeing it with a camera it should get a full look.