mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix bug forcing rtsp for audio detection ffmpeg process (#8156)
* Fix forcing rtsp for audio process * Send as list
This commit is contained in:
parent
9b687d77ce
commit
34b315cc8c
@ -14,7 +14,7 @@ import requests
|
|||||||
from setproctitle import setproctitle
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
from frigate.comms.inter_process import InterProcessCommunicator
|
from frigate.comms.inter_process import InterProcessCommunicator
|
||||||
from frigate.config import CameraConfig, FrigateConfig
|
from frigate.config import CameraConfig, CameraInput, FfmpegConfig, FrigateConfig
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
AUDIO_DURATION,
|
AUDIO_DURATION,
|
||||||
AUDIO_FORMAT,
|
AUDIO_FORMAT,
|
||||||
@ -39,13 +39,29 @@ except ModuleNotFoundError:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_ffmpeg_command(input_args: list[str], input_path: str) -> list[str]:
|
def get_ffmpeg_command(ffmpeg: FfmpegConfig) -> list[str]:
|
||||||
return get_ffmpeg_arg_list(
|
ffmpeg_input: CameraInput = [i for i in ffmpeg.inputs if "audio" in i.roles][0]
|
||||||
f"ffmpeg {{}} -i {{}} -f {AUDIO_FORMAT} -ar {AUDIO_SAMPLE_RATE} -ac 1 -y {{}}".format(
|
input_args = get_ffmpeg_arg_list(ffmpeg.global_args) + (
|
||||||
" ".join(input_args),
|
parse_preset_input(ffmpeg_input.input_args, 1)
|
||||||
input_path,
|
or ffmpeg_input.input_args
|
||||||
|
or parse_preset_input(ffmpeg.input_args, 1)
|
||||||
|
or ffmpeg.input_args
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
["ffmpeg", "-vn"]
|
||||||
|
+ input_args
|
||||||
|
+ ["-i"]
|
||||||
|
+ [ffmpeg_input.path]
|
||||||
|
+ [
|
||||||
|
"-f",
|
||||||
|
f"{AUDIO_FORMAT}",
|
||||||
|
"-ar",
|
||||||
|
f"{AUDIO_SAMPLE_RATE}",
|
||||||
|
"-ac",
|
||||||
|
"1",
|
||||||
|
"-y",
|
||||||
"pipe:",
|
"pipe:",
|
||||||
)
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -173,11 +189,7 @@ class AudioEventMaintainer(threading.Thread):
|
|||||||
self.shape = (int(round(AUDIO_DURATION * AUDIO_SAMPLE_RATE)),)
|
self.shape = (int(round(AUDIO_DURATION * AUDIO_SAMPLE_RATE)),)
|
||||||
self.chunk_size = int(round(AUDIO_DURATION * AUDIO_SAMPLE_RATE * 2))
|
self.chunk_size = int(round(AUDIO_DURATION * AUDIO_SAMPLE_RATE * 2))
|
||||||
self.logger = logging.getLogger(f"audio.{self.config.name}")
|
self.logger = logging.getLogger(f"audio.{self.config.name}")
|
||||||
self.ffmpeg_cmd = get_ffmpeg_command(
|
self.ffmpeg_cmd = get_ffmpeg_command(self.config.ffmpeg)
|
||||||
get_ffmpeg_arg_list(self.config.ffmpeg.global_args)
|
|
||||||
+ parse_preset_input("preset-rtsp-audio-only", 1),
|
|
||||||
[i.path for i in self.config.ffmpeg.inputs if "audio" in i.roles][0],
|
|
||||||
)
|
|
||||||
self.logpipe = LogPipe(f"ffmpeg.{self.config.name}.audio")
|
self.logpipe = LogPipe(f"ffmpeg.{self.config.name}.audio")
|
||||||
self.audio_listener = None
|
self.audio_listener = None
|
||||||
|
|
||||||
|
@ -256,13 +256,6 @@ PRESETS_INPUT = {
|
|||||||
"-use_wallclock_as_timestamps",
|
"-use_wallclock_as_timestamps",
|
||||||
"1",
|
"1",
|
||||||
],
|
],
|
||||||
"preset-rtsp-audio-only": [
|
|
||||||
"-rtsp_transport",
|
|
||||||
"tcp",
|
|
||||||
TIMEOUT_PARAM,
|
|
||||||
"5000000",
|
|
||||||
"-vn",
|
|
||||||
],
|
|
||||||
"preset-rtsp-restream": _user_agent_args
|
"preset-rtsp-restream": _user_agent_args
|
||||||
+ [
|
+ [
|
||||||
"-rtsp_transport",
|
"-rtsp_transport",
|
||||||
|
Loading…
Reference in New Issue
Block a user