Spaces:
Runtime error
Runtime error
File size: 616 Bytes
b43c9f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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
|