AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.67k stars 379 forks source link

Select http jpeg source when creating snapshot for homekit #996

Open latargere opened 6 months ago

latargere commented 6 months ago

Hi,

I have started using this module for homekit support and I have a bunch of Reolink camera that has a snapshot urls. When using homekit, it would be great if the source used for creating a snapshot will select the jpeg source instead of using the full stream that needs to be transcoded.

AlexxIT commented 6 months ago

If stream will have jpeg source earlier than video source - jpeg source will be used for snapshot. But first source (jpeg) will be called on each open stream. This process should be optimized in the future.

alyyousuf7 commented 1 month ago

my front doorbell video source is pretty tall (Nest HASS integration):

image
streams:
    front_doorbell:
        - hass://supervisor?entity_id=camera.front_doorbell

but for some reason the snapshot HomeKit takes from the video stream does not seem right (aspect ratio gets screwed up):

image

to fix that, i have to create another stream, so that i can use ffmpeg to output an mjpeg stream for snapshot:

streams:
    front_doorbell_og:
        - hass://supervisor?entity_id=camera.front_doorbell
    front_doorbell:
        - ffmpeg:front_doorbell_og#video=mjpeg
        - hass://supervisor?entity_id=camera.front_doorbell

this works fine ^ - HomeKit does show cropped snapshot - but that's fine by me

image

but is there a better way, to avoid creating another named stream? it seems i cannot do the following:

streams:
    front_doorbell:
        - ffmpeg:hass://supervisor?entity_id=camera.front_doorbell#video=mjpeg # this is not a valid - it doesn't work
        - hass://supervisor?entity_id=camera.front_doorbell
OR
streams:
    front_doorbell:
        - ffmpeg:front_doorbell#video=mjpeg # this does not have a video stream yet to generate mjpeg
        - hass://supervisor?entity_id=camera.front_doorbell