mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Return full output of ffprobe process
This commit is contained in:
parent
8a39f42255
commit
0b2f4ea525
@ -619,31 +619,31 @@ def ffprobe(camera_name):
|
|||||||
|
|
||||||
if len(config.ffmpeg.inputs) > 1:
|
if len(config.ffmpeg.inputs) > 1:
|
||||||
# user has multiple streams
|
# user has multiple streams
|
||||||
output = ""
|
output = []
|
||||||
|
|
||||||
for input in config.ffmpeg.inputs:
|
for input in config.ffmpeg.inputs:
|
||||||
output += f"{input.roles}\n"
|
|
||||||
ffprobe = ffprobe_stream(input.path)
|
ffprobe = ffprobe_stream(input.path)
|
||||||
|
output.append(
|
||||||
if ffprobe:
|
{
|
||||||
output += f"{ffprobe}\n"
|
"input_roles": input.roles,
|
||||||
else:
|
"return_code": ffprobe.returncode,
|
||||||
output += "error getting stream\n"
|
"stderr": ffprobe.stderr,
|
||||||
|
"stdout": ffprobe.stdout,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return jsonify(output, "200")
|
return jsonify(output, "200")
|
||||||
else:
|
else:
|
||||||
# user has single stream
|
# user has single stream
|
||||||
ffprobe = ffprobe_stream(config.ffmpeg.inputs[0].path)
|
ffprobe = ffprobe_stream(config.ffmpeg.inputs[0].path)
|
||||||
if not ffprobe:
|
return jsonify(
|
||||||
return jsonify(
|
{
|
||||||
{
|
"input_roles": config.ffmpeg.inputs[0].roles,
|
||||||
"success": False,
|
"return_code": ffprobe.returncode,
|
||||||
"message": f"ffprobe unable to get info for {camera_name}",
|
"stderr": ffprobe.stderr,
|
||||||
},
|
"stdout": ffprobe.stdout,
|
||||||
"500",
|
}
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
return jsonify(ffprobe, "200")
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/<camera_name>")
|
@bp.route("/<camera_name>")
|
||||||
|
|||||||
@ -712,7 +712,7 @@ def get_cpu_stats() -> dict[str, dict]:
|
|||||||
return usages
|
return usages
|
||||||
|
|
||||||
|
|
||||||
def ffprobe_stream(path: str) -> str:
|
def ffprobe_stream(path: str) -> sp.CompletedProcess:
|
||||||
"""Run ffprobe on stream."""
|
"""Run ffprobe on stream."""
|
||||||
ffprobe_cmd = [
|
ffprobe_cmd = [
|
||||||
"ffprobe",
|
"ffprobe",
|
||||||
@ -724,13 +724,7 @@ def ffprobe_stream(path: str) -> str:
|
|||||||
"quiet",
|
"quiet",
|
||||||
path,
|
path,
|
||||||
]
|
]
|
||||||
p = sp.run(ffprobe_cmd, capture_output=True)
|
return sp.run(ffprobe_cmd, capture_output=True)
|
||||||
|
|
||||||
if p.returncode != 0:
|
|
||||||
logger.error(f"ffprobe unable to get result for stream: {p.stderr}")
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
return p.stdout.decode().strip()
|
|
||||||
|
|
||||||
|
|
||||||
class FrameManager(ABC):
|
class FrameManager(ABC):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user