Update go2rtc, simplify manual stream, and support audio for MSE & WebRTC (#4391)

* Update go2rtc to rc3

* Simplify ffmpeg / audio conversions

* Set ffmpeg bin location

* Manually set video as copied

* Run go2rtc with env vars

* Remove manual ffmpeg declaration

* Enable force_audio by default

* Fix test
This commit is contained in:
Nicolas Mowen 2022-11-16 05:29:47 -07:00 committed by GitHub
parent 664e04836d
commit 4eb3e98076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 5 deletions

View File

@ -119,7 +119,7 @@ RUN --mount=type=bind,from=wheels,source=/wheels,target=/wheels \
ENV PATH=$PATH:/usr/lib/btbn-ffmpeg/bin
# install go2rtc
RUN wget -O go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-rc.2/go2rtc_linux_${TARGETARCH}" \
RUN wget -O go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v0.1-rc.3/go2rtc_linux_${TARGETARCH}" \
&& chmod +x go2rtc \
&& mkdir -p /usr/local/go2rtc/sbin/ \
&& mv go2rtc /usr/local/go2rtc/sbin/go2rtc

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/with-contenv bash
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425?permalink_comment_id=3945021
set -euo pipefail

View File

@ -354,7 +354,7 @@ restream:
# Optional: Enable the restream (default: True)
enabled: True
# Optional: Force audio compatibility with browsers (default: shown below)
force_audio: False
force_audio: True
# Optional: jsmpeg stream configuration for WebUI
jsmpeg:
# Optional: Set the height of the jsmpeg stream. (default: 720)

View File

@ -536,7 +536,7 @@ class JsmpegStreamConfig(FrigateBaseModel):
class RestreamConfig(FrigateBaseModel):
enabled: bool = Field(default=True, title="Restreaming enabled.")
force_audio: bool = Field(
default=False, title="Force audio compatibility with the browser."
default=True, title="Force audio compatibility with the browser."
)
jsmpeg: JsmpegStreamConfig = Field(
default_factory=JsmpegStreamConfig, title="Jsmpeg Stream Configuration."

View File

@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
def get_manual_go2rtc_stream(camera_url: str) -> str:
"""Get a manual stream for go2rtc."""
return f"exec: /usr/lib/btbn-ffmpeg/bin/ffmpeg -i {camera_url} -c:v copy -c:a libopus -rtsp_transport tcp -f rtsp {{output}}"
return f"ffmpeg:{camera_url}#video=copy#audio=aac#audio=opus"
class RestreamApi:

View File

@ -25,6 +25,7 @@ class TestRestream(TestCase):
},
"restream": {
"enabled": True,
"force_audio": False,
},
},
"front": {