mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-04 10:15:22 +03:00
Add ffprobe endpoint
This commit is contained in:
parent
68248cc274
commit
aadc8a8d3d
@ -26,6 +26,7 @@ from flask import (
|
||||
from peewee import SqliteDatabase, operator, fn, DoesNotExist
|
||||
from playhouse.shortcuts import model_to_dict
|
||||
|
||||
from frigate.config import CameraConfig
|
||||
from frigate.const import CLIPS_DIR
|
||||
from frigate.models import Event, Recordings
|
||||
from frigate.object_processing import TrackedObject
|
||||
@ -612,6 +613,40 @@ def stats():
|
||||
return jsonify(stats)
|
||||
|
||||
|
||||
@bp.route("/<camera_name>/ffprobe")
|
||||
def ffprobe(camera_name):
|
||||
if camera_name not in current_app.frigate_config.cameras:
|
||||
return jsonify(
|
||||
{"success": False, "message": f"Camera name {camera_name} not found"}, "404"
|
||||
)
|
||||
|
||||
config: CameraConfig = current_app.frigate_config.cameras[camera_name]
|
||||
|
||||
if len(config.ffmpeg.inputs) > 1:
|
||||
# user has multiple streams
|
||||
ffprobe_cmd = [
|
||||
"ffprobe",
|
||||
"-rtsp_transport",
|
||||
"tcp",
|
||||
config.ffmpeg.inputs[0].path,
|
||||
]
|
||||
else:
|
||||
# user has single stream
|
||||
ffprobe = ffprobe_stream(config.ffmpeg.inputs[0].path)
|
||||
if not ffprobe:
|
||||
return jsonify(
|
||||
{
|
||||
"success": False,
|
||||
"message": f"ffprobe unable to get info for {camera_name}",
|
||||
},
|
||||
"500",
|
||||
)
|
||||
else:
|
||||
return jsonify(
|
||||
{"success": True, "message": ffprobe}, "200"
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/<camera_name>")
|
||||
def mjpeg_feed(camera_name):
|
||||
fps = int(request.args.get("fps", "3"))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user