question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Support]: HA RTMP No audio, Working in VLC

See original GitHub issue

Describe the problem you are having

Hi, the RTMP stream from my camera audio works in vlc, But in Home Asstaint the audio is not working also on the recording,

Version

0.9.4-26AE608

Frigate config file

mqtt:
  host: 192.168.1.172
  user: ****
  password: *****
  
cameras:
  Livingroomcam:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.93:8554/unicast
          roles:
            - detect
            - clips
            - rtmp
        output_args:
          record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
          rtmp: -c copy -f flv -c:v copy -c:a aac
          
  driveway:
    ffmpeg:
      inputs:
        - path: rtsp://***:****@192.168.1.230/videoMain
          roles:
            - detect
            - clips
            - rtmp
detect:
  # Optional: width of the frame for the input with the detect role (default: shown below)
  width: 1280
  # Optional: height of the frame for the input with the detect role (default: shown below)
  height: 720
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 5
  # Optional: enables detection for the camera (default: True)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25

# Optional: Object configuration
# NOTE: Can be overridden at the camera level
objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
  # Optional: mask to prevent all object types from being detected in certain areas (default: no mask)
  # Checks based on the bottom center of the bounding box of the object.
  # NOTE: This mask is COMBINED with the object type specific mask below
  mask: 0,0,1000,0,1000,200,0,200
          
detectors:
  cpu1:
    type: cpu
    
record:
  enabled: True
  # retain_days: 0
  events:
    retain:
      default: 10
    

Relevant log output

[2022-01-09 00:31:40] ffmpeg.Livingroomcam.detect    ERROR   : rtsp://192.168.1.93:8554/unicast: corrupt decoded frame in stream 0
[2022-01-09 00:31:40] ffmpeg.Livingroomcam.detect    ERROR   : [flv @ 0x5644588479c0] Failed to update header with correct duration.
[2022-01-09 00:31:40] ffmpeg.Livingroomcam.detect    ERROR   : [flv @ 0x5644588479c0] Failed to update header with correct filesize.
[2022-01-09 00:32:41] frigate.video                  INFO    : Livingroomcam: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2022-01-09 00:32:41] frigate.video                  INFO    : Livingroomcam: ffmpeg process is not running. exiting capture thread...
[2022-01-09 00:32:50] watchdog.Livingroomcam         ERROR   : FFMPEG process crashed unexpectedly for Livingroomcam.
[2022-01-09 00:32:50] watchdog.Livingroomcam         ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-01-09 00:32:50] watchdog.Livingroomcam         ERROR   : You may have invalid args defined for this camera.
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   : Guessed Channel Layout for Input Stream #0.1 : mono
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   : [flv @ 0x560b65effec0] 16-bit big-endian audio in flv is valid but most likely unplayable (hardware dependent); use s16le
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   : [rtsp @ 0x560b65ef8dc0] CSeq 6 expected, 0 received.
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   :     Last message repeated 332 times
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   : rtsp://192.168.1.93:8554/unicast: corrupt decoded frame in stream 0
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   : [flv @ 0x560b65effec0] Failed to update header with correct duration.
[2022-01-09 00:32:50] ffmpeg.Livingroomcam.detect    ERROR   : [flv @ 0x560b65effec0] Failed to update header with correct filesize.

FFprobe output from your camera


Frigate stats

{
  "birdseye": {
    "enabled": true,
    "height": 720,
    "mode": "objects",
    "quality": 8,
    "width": 1280
  },
  "cameras": {
    "Livingroomcam": {
      "best_image_timeout": 60,
      "detect": {
        "enabled": true,
        "fps": 5,
        "height": 720,
        "max_disappeared": 25,
        "width": 1280
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [],
        "input_args": [
          "-avoid_negative_ts",
          "make_zero",
          "-fflags",
          "+genpts+discardcorrupt",
          "-rtsp_transport",
          "tcp",
          "-stimeout",
          "5000000",
          "-use_wallclock_as_timestamps",
          "1"
        ],
        "inputs": [
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://192.168.1.93:8554/unicast",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "rtmp": [
            "-c",
            "copy",
            "-f",
            "flv"
          ]
        }
      },
      "ffmpeg_cmds": [
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://192.168.1.93:8554/unicast -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Livingroomcam-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/Livingroomcam -r 5 -s 1280x720 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 99,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 180,
        "mask": "",
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "Livingroomcam",
      "objects": {
        "filters": {
          "person": {
            "mask": [
              "0,0,1000,0,1000,200,0,200"
            ],
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "0,0,1000,0,1000,200,0,200",
        "track": [
          "person"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [],
          "retain": {
            "default": 10,
            "objects": {}
          }
        },
        "retain_days": 0
      },
      "rtmp": {
        "enabled": true
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "height": null,
        "quality": 70,
        "required_zones": [],
        "retain": {
          "default": 10,
          "objects": {}
        },
        "timestamp": false
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "zones": {}
    },
    "driveway": {
      "best_image_timeout": 60,
      "detect": {
        "enabled": true,
        "fps": 5,
        "height": 720,
        "max_disappeared": 25,
        "width": 1280
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [],
        "input_args": [
          "-avoid_negative_ts",
          "make_zero",
          "-fflags",
          "+genpts+discardcorrupt",
          "-rtsp_transport",
          "tcp",
          "-stimeout",
          "5000000",
          "-use_wallclock_as_timestamps",
          "1"
        ],
        "inputs": [
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://*****:d****@192.168.1.230/videoMain",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "rtmp": [
            "-c",
            "copy",
            "-f",
            "flv"
          ]
        }
      },
      "ffmpeg_cmds": [
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://****:****@192.168.1.230/videoMain -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/driveway-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/driveway -r 5 -s 1280x720 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 99,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 180,
        "mask": "",
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "driveway",
      "objects": {
        "filters": {
          "person": {
            "mask": [
              "0,0,1000,0,1000,200,0,200"
            ],
            "max_area": 24000000,
            "min_area": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "0,0,1000,0,1000,200,0,200",
        "track": [
          "person"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "max_seconds": 300,
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [],
          "retain": {
            "default": 10,
            "objects": {}
          }
        },
        "retain_days": 0
      },
      "rtmp": {
        "enabled": true
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "height": null,
        "quality": 70,
        "required_zones": [],
        "retain": {
          "default": 10,
          "objects": {}
        },
        "timestamp": false
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "zones": {}
    }
  },
  "database": {
    "path": "/media/frigate/frigate.db"
  },
  "detect": {
    "enabled": true,
    "fps": 5,
    "height": 720,
    "max_disappeared": 25,
    "width": 1280
  },
  "detectors": {
    "cpu1": {
      "device": "usb",
      "num_threads": 3,
      "type": "cpu"
    }
  },
  "environment_vars": {},
  "ffmpeg": {
    "global_args": [
      "-hide_banner",
      "-loglevel",
      "warning"
    ],
    "hwaccel_args": [],
    "input_args": [
      "-avoid_negative_ts",
      "make_zero",
      "-fflags",
      "+genpts+discardcorrupt",
      "-rtsp_transport",
      "tcp",
      "-stimeout",
      "5000000",
      "-use_wallclock_as_timestamps",
      "1"
    ],
    "output_args": {
      "detect": [
        "-f",
        "rawvideo",
        "-pix_fmt",
        "yuv420p"
      ],
      "record": [
        "-f",
        "segment",
        "-segment_time",
        "10",
        "-segment_format",
        "mp4",
        "-reset_timestamps",
        "1",
        "-strftime",
        "1",
        "-c",
        "copy",
        "-an"
      ],
      "rtmp": [
        "-c",
        "copy",
        "-f",
        "flv"
      ]
    }
  },
  "live": {
    "height": 720,
    "quality": 8
  },
  "logger": {
    "default": "info",
    "logs": {}
  },
  "model": {
    "height": 320,
    "labelmap": {},
    "labelmap_path": null,
    "path": null,
    "width": 320
  },
  "motion": null,
  "mqtt": {
    "client_id": "frigate",
    "host": "192.168.1.172",
    "password": "*****",
    "port": 1883,
    "stats_interval": 60,
    "tls_ca_certs": null,
    "tls_client_cert": null,
    "tls_client_key": null,
    "tls_insecure": null,
    "topic_prefix": "frigate",
    "user": "mqtt"
  },
  "objects": {
    "filters": null,
    "mask": "0,0,1000,0,1000,200,0,200",
    "track": [
      "person"
    ]
  },
  "record": {
    "enabled": true,
    "events": {
      "max_seconds": 300,
      "objects": null,
      "post_capture": 5,
      "pre_capture": 5,
      "required_zones": [],
      "retain": {
        "default": 10,
        "objects": {}
      }
    },
    "retain_days": 0
  },
  "rtmp": {
    "enabled": true
  },
  "snapshots": {
    "bounding_box": true,
    "clean_copy": true,
    "crop": false,
    "enabled": false,
    "height": null,
    "quality": 70,
    "required_zones": [],
    "retain": {
      "default": 10,
      "objects": {}
    },
    "timestamp": false
  },
  "timestamp_style": {
    "color": {
      "blue": 255,
      "green": 255,
      "red": 255
    },
    "effect": null,
    "format": "%m/%d/%Y %H:%M:%S",
    "position": "tl",
    "thickness": 2
  }
}

Operating system

HassOS

Install method

HassOS Addon

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Dahua

Any other information that may be helpful

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Jan 11, 2022

Those arguments tell ffmpeg to re-encode the audio to aac regardless of what the camera setting is. It’s best if it’s aac at the camera so it doesn’t have to re-encode. I would remove the -c copy at the beginning and leave everything else the same.

0reactions
stale[bot]commented, Feb 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Easiest Ways Here! Fix VLC No Sound Problems
The first solution you can implement to fix VLC No Sound is to unmute audio on VLC. The unmuting VLC media player is...
Read more >
No Audio From FFmpeg RTSP Stream - Configuration
My understanding is that HA works as a Proxy, talking to the camera (rtsp in this case) on one side of the Proxy,...
Read more >
No audio rtsp -> sout but works when just playing stream
I am trying to capture the output of a Sony 4K SNC-VM772R security camera that streams H264/AAC over RTSP. If I just play...
Read more >
Page 2 – Experiences and walk throughs from ... - Kernel Manic
Use VLC to play the recordings. To view the stream live with VLC click Media->Open Network Stream and enter the network URL “rtmp://192.168.164.110/view/ ......
Read more >
Tips for Fixing VLC Player Has No Sound - VideoSolo
How to update VLC: Click on "Help-Check for Updates". · Step 1.Open the VLC Media Player and play a video. · Step 2.Click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found