forked from Github/frigate
Revamped debug UI and add camera / process info, ffprobe copying (#4349)
* Move each camera to a separate card and show per process info * Install top * Add support for cpu usage stats * Use cpu usage stats in debug * Increase number of runs to ensure good results * Add ffprobe endpoint * Get ffprobe for multiple inputs * Copy ffprobe in output * Add fps to camera metrics * Fix lint errors * Update stats config * Add ffmpeg pid * Use grid display so more cameras can take less vertical space * Fix hanging characters * Only show the current detector * Fix bad if statement * Return full output of ffprobe process * Return full output of ffprobe process * Don't specify rtsp_transport * Make ffprobe button show dialog with output and option to copy * Adjust ffprobe api to take paths directly * Add docs for ffprobe api
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import base64
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime, timedelta
|
||||
import copy
|
||||
import logging
|
||||
import json
|
||||
import os
|
||||
import subprocess as sp
|
||||
import time
|
||||
@@ -28,9 +28,9 @@ from playhouse.shortcuts import model_to_dict
|
||||
|
||||
from frigate.const import CLIPS_DIR
|
||||
from frigate.models import Event, Recordings
|
||||
from frigate.object_processing import TrackedObject, TrackedObjectProcessor
|
||||
from frigate.object_processing import TrackedObject
|
||||
from frigate.stats import stats_snapshot
|
||||
from frigate.util import clean_camera_user_pass
|
||||
from frigate.util import clean_camera_user_pass, ffprobe_stream
|
||||
from frigate.version import VERSION
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -957,3 +957,37 @@ def imagestream(detected_frames_processor, camera_name, fps, height, draw_option
|
||||
b"--frame\r\n"
|
||||
b"Content-Type: image/jpeg\r\n\r\n" + jpg.tobytes() + b"\r\n\r\n"
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/ffprobe", methods=["GET"])
|
||||
def ffprobe():
|
||||
path_param = request.args.get("paths", "")
|
||||
|
||||
if not path_param:
|
||||
return jsonify(
|
||||
{"success": False, "message": f"Path needs to be provided."}, "404"
|
||||
)
|
||||
|
||||
if "," in clean_camera_user_pass(path_param):
|
||||
paths = path_param.split(",")
|
||||
else:
|
||||
paths = [path_param]
|
||||
|
||||
# user has multiple streams
|
||||
output = []
|
||||
|
||||
for path in paths:
|
||||
ffprobe = ffprobe_stream(path)
|
||||
output.append(
|
||||
{
|
||||
"return_code": ffprobe.returncode,
|
||||
"stderr": json.loads(ffprobe.stderr.decode("unicode_escape").strip())
|
||||
if ffprobe.stderr.decode()
|
||||
else {},
|
||||
"stdout": json.loads(ffprobe.stdout.decode("unicode_escape").strip())
|
||||
if ffprobe.stdout.decode()
|
||||
else {},
|
||||
}
|
||||
)
|
||||
|
||||
return jsonify(output)
|
||||
|
||||
Reference in New Issue
Block a user