Spaces:
Runtime error
Runtime error
import ffmpeg | |
from transformers import Tool | |
class VideoCompressionTool(Tool): | |
name = "video_compression_tool" | |
description = """ | |
This tool compresses input video/gif to optimized video/gif. | |
Inputs are input_path, output_path. | |
Output is output_path. | |
""" | |
inputs = ["text", "text"] | |
outputs = ["text"] | |
def __call__(self, input_path: str, output_path: str): | |
( | |
ffmpeg.input(input_path) | |
.filter_("split", "[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse") | |
.output(output_path) | |
.run() | |
) | |
return output_path | |