Code Monkey home page Code Monkey logo

Comments (44)

Hamish1066 avatar Hamish1066 commented on August 16, 2024 1

OK I FINALLY GO THIS WORKING WOOOOOOOO!

So, this issue is h.265. It turns out that, although both iOS and MacOS can play h.265 video, as I stated above, it cannot play video transcoded with FFmpeg. But there is a workaround (below).

I had two issues here:

  1. The FFmpeg transcoding not playing on Apple devices (I understand it works fine on Android); and
  2. Trying to play the clip in the HA companion app vs the web.

On issue 2, I was trying to play the clips directly within the companion app using this instead of the "View Clip" drop down option:

/frigate/notifications/{{id}}/{{camera}}/clip.mp4

That forced it to open the clip in the HA app rather than the browser, and caused the playback issued described above.

On issue 1, I found you can force compatibility by adding -tag:v hvc1 \ to your FFmpeg line in your Frigate config. This gives you an hvc1 output instead of hev1, which is incompatible with Apple.

My complete FFmpeg config is as follows (though only the one line mentioned above is necessary to get this to work:

ffmpeg:
  hwaccel_args: preset-vaapi
  input_args: -tag:v hvc1 
  output_args:
    record: preset-record-generic-audio-aac

@SgtBatten Thanks for your patience on this. I really appreciate you supporting such an awesome project (or projects - both HA and Frigate), and really appreciate you taking the time to create this Blueprint and respond to me. I'll leave this open for a day so that @Solarflor can try it out to confirm it's working, then assuming this works for that person we can close this issue.

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024 1

FINALLY IT WORKS
sorry, really sorry but my problem was create by a stupid copy and past I did.
I added hwaccel_args: preset-rpi-64-h264 although I'm using a Dahua h265 camera.
Now I removed it and it works.

Many, many thanks to both of you and really sorry for wasting your time

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024 1

Thanks everyone - I'll mark this as closed.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024
/frigate/notifications/{{id}}/camera.front_door_2/clip.mp4

This is invalid.

the camera name needs to match frigate config. and not have 'camera.' at the front.

so camera.front_door_2 probably needs to be just front_door i assume, which it would have been by default.

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024
/frigate/notifications/{{id}}/camera.front_door_2/clip.mp4

This is invalid.

the camera name needs to match frigate config. and not have 'camera.' at the front.

so camera.front_door_2 probably needs to be just front_door i assume, which it would have been by default.

Thanks. I tried it with {{camera}} and front_door as you recommended, but it didn't work. They both show the image here: https://www.reddit.com/r/homeassistant/comments/155vtoh/frigate_blueprint_clip_broken/

I also tried changing the name to "front_yard" so there is no more conflict with the other camera entity, and tried using the blueprint with just the drop downs, but I still get the image above. I've confirmed that I can otherwise see the clips on my devices.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Copy the url that it opens onto a device on your local network. Remove the nabu casa url and replace it with the Lan IP and port of home assistant. Any difference?

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

It didn't work with the Lan IP, but it did work when I replaced the Nabu Casa URL with homeassistant.local:8123. However, it only works in Chrome, and only on my laptop, not on my iPhone. I also tried pasting the Nabu Casa URL into Chrome, and it won't load - it just gives me a black video box that says "0:00" for time and the play button doesn't do anything.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Perhaps a codec issue. Are the cams outputting h.265?

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

You said it wouldn't work with your nabu casa url even in chrome so I assume the same reason is the issue for the app. Though on android it doesn't open in the app, it opens in a browser so I can't play h.265 clips. I run two recorders for the hm265 cam. One in h.264 for being able to view it everywhere. And one just recording in beat quality in case I need it.

I suggest you try without the base url set and see what occurs.

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

h.265 is not well supported still. I cannot play it on any of my devices, even my desktop computer due to older hardware. I also have reolink cams and there were heaps of resources on this topic I used when i set them up. Some cams can be tricked into h.264 with slight reductions in resolution, others only do h.265 on certain streams like my duo2.

I agree it's weird you can view it in the app when browsing frigate normally but not via the api. How certain are you it's opening in the app?

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

The duo2 is the only 265 cam I have but I read about many others over the time.

If I recall correctly the main duo2 stream is only 265. The substream is only 264. So in frigate I have two cams setup for the one duo2. One which detects and records on the 264 substream. I use this for all my notifications. The other cam detects on 264 and records the main 265 stream so I have the highest resolution recorded if I need to pull tapes.

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

are you able to share the yaml for how the automation opens the specific clip, and perhaps I could try it in another automation without the blueprint?

You've already done this. The automation just open the url. It has some behind the scenes bits to generate the ID but if you've copied it, and pasted it somewhere else that's the whole process.

Frigate generates the event I'd and we are simply using the frigate notification API from the integration.

Can you please check what you have configured for the integration?

Screenshot_20230724-071203

Frigate config I will share in a little bit.

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Here is the reference to the api we are using. It hasn't changed in forever so we know it's good. https://docs.frigate.video/integrations/home-assistant/#notification-api

to get the id, one easy way is to go to frigate events, click and event, click snapshot instead of clip
image

right click and open the image in new window. the url contains the relevant ID near the end where it says /api/events/3620134358.35426-gydf7o/snapshot.jpg

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

I've cut most of this out just to show the relevant bits. All the cams below are reolink but the duo2 is the only one with a 265 stream. My config was a lot of trial and error and is not perfect, just showing you what i have working currently. front and front4k are the two frigate cams i pull from the duo2.

go2rtc:
  streams:
    side: http://192.168.1.81/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password={FRIGATE_REOLINK_PASSWORD}
    side_sub: http://192.168.1.81/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password={FRIGATE_REOLINK_PASSWORD}
    front_sub: ffmpeg:http://192.168.1.82/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=admin&password={FRIGATE_REOLINK_PASSWORD}
    doorbell: http://192.168.1.83/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password={FRIGATE_REOLINK_PASSWORD}
    doorbell_sub: http://192.168.1.83/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password={FRIGATE_REOLINK_PASSWORD}

cameras:
side:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/side?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/side_sub?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect

  front:
    ffmpeg:
      inputs:        
        - path: rtsp://127.0.0.1:8554/front_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect

  front_4K:
    ffmpeg:
      inputs:
        - path: rtsp://admin:{FRIGATE_REOLINK_PASSWORD}@192.168.1.82:554/h265Preview_01_main
          roles:
            - record
          hwaccel_args:
            -hwaccel vaapi
            -hwaccel_device /dev/dri/renderD128
            -hwaccel_output_format vaapi
          input_args: 
            -avoid_negative_ts make_zero
            -fflags genpts+discardcorrupt
            -strict experimental
            -analyzeduration 1000M
            -probesize 1000M
        
        - path: rtsp://127.0.0.1:8554/front_sub?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

Thanks. Why is there a difference in the IP addresses for go2rtc vs the camera setups?

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

So I've found that if I hold the notification I can see a live view of the camera stream, and I have the options to view the clip or snapshot. If I click view the clip it gives me the same broken play button image, and if I try the snapshot it worked once but otherwise says not found. Is there a way to configure the stream that pulls up when I hold the notification to show me the clip instead of the live stream? I think that could fix this issue for me, since it seems to be able to play from there.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Thanks. Why is there a difference in the IP addresses for go2rtc vs the camera setups?

Gortc connects to the reolink cams and then restreams them.

For the camera section it's connecting to gortc, not the camera.
Exception is front 4k main stream. I can't remember exactly but direct connection worked better when I set it up.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Is there a way to configure the stream that pulls up when I hold the notification to show me the clip instead of the live stream?

No, is is specifically a live stream entity on iOS.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

You'll need to do some digging into the network/console using a browser.

The fact you couldn't open it when using a Lan IP and port but could when using homeassistant.local is extremely weird to me. What exactly is your network setup?

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

I think I may have found the source of the issue. In the HA media sources folder, there is a “My Media” folder and a “Frigate” folder. If I go into the Frigate folder, everything is recorded as I’ve set it up. However, in the path mymedia/frigate/clips, there is nothing. I suspect clips are being pulled from here which is why they aren’t showing up. Does that make sense?

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

That is normal. The media is in the frigate folder as you said. There integration is what connects frigate media with the HA media folder

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

Hi all,
I'm having a similar issue.
I have installed HA_blueprints Frigate Notifications (0.12.0.1) with notification on my Iphone and it seems to work almost well.
Almost because I'm even able to receive snapshot on my Iwatch.
image

But not on my Iphone where I only can see:
image

Below frigate config

mqtt:
 host: core-mosquitto
 port: 1883
 user: solarflor
 password: floriano1628
birdseye:
  enabled: True
  restream: False
  width: 1280
  height: 720
  quality: 5
  mode: objects
ffmpeg:
  hwaccel_args: preset-rpi-64-h264
detect:
  enabled: True # <---- disable detection until you have a working camera feed
  width: 1920 # <---- update for your camera's resolution
  height: 1080 # <---- update for your camera's resolution
motion:
record:
  enabled: true
  expire_interval: 60
  retain:
    days: 0
    mode: all
  events:
    pre_capture: 3
    post_capture: 3
    objects:
      - person
      - car
    required_zones: []
    retain:
      default: 10
      mode: motion
      objects:
        person: 3
        car: 2
        truck: 2
        bicycle: 2
        motorcycle: 2
        dog: 2
        cat: 2
cameras:
  Piazzale_1: # <------ Name the camera
    ffmpeg:
      hwaccel_args: preset-rpi-64-h264
      inputs:
        - path: rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1 # <----- The stream you want to use for detection
          roles:
            - detect
    objects:
      track:
        - person
        - car
    record: # <----- Enable recording
      enabled: True
    snapshots: # <----- Enable snapshots
      enabled: True

I have a Dahua Camera IPC-HFW3441T-ZS

Thanks for your support

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

@Solarflor can you please share your automation config?

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

Here it is

alias: Frigate Notifications (0.12.0.1)
description: ""
use_blueprint:
  path: SgtBatten/Stable.yaml
  input:
    camera: camera.piazzale_1
    notify_device: b76118c030e61eef2c2eee37a5d0fc0e
    attachment: snapshot
    labels:
      - person
    presence_filter: person.floriano

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

sorry, not sure why the code is showed as above (no readable way). I used the <> comand

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

I'm still working at this problem btw. Interesting to see someone else has it. I've tested the notification on my MacBook Pro as well. When I open the notification in Safari, I get the same broken play button icon and no video. In Firefox, I get a video player that just plays black for the amount of the clip. In Chrome, it works fine. I've tried opening it in Chrome on my iPhone as well, but I get the broken play button.

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

Another update - this is definitely related to file format issues with iOS/MacOS/Safari. I downloaded VLC for iPhone and tried the clip there - it plays fine.

Is there a way to update the HA app so it can play these videos, or alternatively open the clips in VLC from the notification?

I'm still not sure why these videos won't play on iOS/MacOS/Safari, when in theory they are h.265 so therefore compatible. Maybe there is an issue with my Frigate config? Or possibly my HA config?

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

H.265 is not supported as far as I know. Not on android either.

But you said it also happened on h.264?

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Here it is

Have you tried using a baseurl?

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

Have you tried using a baseurl?

give me some more instruction please

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

give me some more instruction please

How do you access home assistant remotely? Do you have a url you setup?

E.g through nabu casa or you own private domain.

Or maybe you only use it at home, still you would have the Lan IP address and port and could use that.

Whatever it is, enter it in the bases url field in the automation.

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

How do you access home assistant remotely?

I have a duckdns url.

Whatever it is, enter it in the bases url field in the automation

do you mean someting like
base_url: http://[myurl].duckdns.org
ok I will try although it is not a protect url (https)

from ha_blueprints.

Hamish1066 avatar Hamish1066 commented on August 16, 2024

H.265 is not supported as far as I know. Not on android either.

But you said it also happened on h.264?

H.265 is supported on iPhone and MacOS, but I understand from some further reading that certain transcoders, including FFmpeg which is used by Frigate, aren’t compatible.

And yes, I’ve had the same issue using my h.264 cameras.

from ha_blueprints.

SgtBatten avatar SgtBatten commented on August 16, 2024

Thanks for the update mate. Great work

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

ok I will try

Unfortunately it doesn't work

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

OK I FINALLY GO THIS WORKING WOOOOOOOO!

Hi Hamish,
how I should change my config file (see above) to solve the problem?
Thanks for your help

from ha_blueprints.

Solarflor avatar Solarflor commented on August 16, 2024

I have changed the configuration as below

cameras: Piazzale_1: # <------ Name the camera ffmpeg: hwaccel_args: preset-rpi-64-h264 input_args: -tag:v hvc1 inputs: - path: rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=1 # <----- The stream you want to use for detection roles: - detect
but still doesn't work

from ha_blueprints.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.