Spaces:
Runtime error
Runtime error
| import json | |
| import ffmpeg | |
| from transformers import Tool | |
| class FFProbeTool(Tool): | |
| name = "ffprobe_tool" | |
| description = """ | |
| This tool extracts metadata from input video using ffmpeg/ffprobe | |
| Input is input_path. Output is a text string. | |
| """ | |
| inputs = ["text"] | |
| outputs = ["text"] | |
| def __call__(self, input_path: str): | |
| probe = ffmpeg.probe(input_path) | |
| return json.dumps(next( | |
| (stream for stream in probe["streams"] if stream["codec_type"] == "video"), | |
| None, | |
| ), indent=2) | |