audio-adjustment-tool / audio_adjustment.py
smellslikeml
format output
336ddb1
import ffmpeg
from transformers import Tool
class AudioAdjustmentTool(Tool):
name = "audio_adjustment_tool"
description = """
This tool modifies audio levels for an input video.
Inputs are input_path, output_path, level (e.g. 0.5 or -13dB).
"""
inputs = ["text", "text", "text"]
outputs = ["text"]
def __call__(self, input_path: str, output_path: str, level: str):
(
ffmpeg.input(input_path)
.output(output_path, af="volume={}".format(level))
.run()
)
return output_path