summaryrefslogtreecommitdiff
path: root/lib/sounds.php
blob: 23f566f27438b9434c4a0eff50b158ecd3eba8d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
<?php
function compress_sound(string $input_file, string $output_file)
{
    if (!is_file($input_file)) {
        throw new RuntimeException("Sound input file does not exist.");
    }

    $input_file = escapeshellarg($input_file);
    $output_file = escapeshellarg($output_file);

    shell_exec("ffmpeg -i $input_file -c:a libvorbis -q:a 1 $output_file");
}