File size: 565 Bytes
b3167b2
 
 
 
 
 
 
 
 
 
336ddb1
b3167b2
 
 
 
 
 
 
336ddb1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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