Пример #1
0
        $tempname1 = getTempWavName();
        decodeWithLame($config['lame'] . " --decode \"{$source}\" \"{$tempname1}\"");
        checkFile($tempname1);
        $tempname2 = getTempWavName();
        convertWithSox($config['sox'] . " \"{$tempname1}\" -c2 \"{$tempname2}\"");
        checkFile($tempname2);
        rmFile($tempname1);
        encodeWithLame($config['lame'] . " --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname2}\" \"{$target}\"");
        checkFile($target);
        rmFile($tempname2);
    } else {
        encodeWithLame($config['lame'] . " --disptime 1 --cbr --mp3input -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$source}\" \"{$target}\"");
    }
} elseif ($config['audioFormats'][$index]['format'] == 'ogg' && $audioFiles->list[$sourceindex]->format == 'mp3') {
    $tempname1 = getTempWavName();
    decodeWithLame($config['lame'] . " --decode \"{$source}\" \"{$tempname1}\"");
    checkFile($tempname1);
    if ($config['audioFormats'][$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) {
        $tempname2 = getTempWavName();
        convertWithSox($config['sox'] . " \"{$tempname1}\" -c2 \"{$tempname2}\"");
        checkFile($tempname2);
        rmFile($tempname1);
        encodeWithOgg($config['oggenc'] . " -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} -o \"{$target}\" \"{$tempname2}\"");
        checkFile($target);
        rmFile($tempname2);
    } else {
        if ($config['audioFormats'][$index]['channels'] == 1 && $audioFiles->list[$sourceindex]->channels == 2) {
            $addparam = "--downmix";
        }
        encodeWithOgg($config['oggenc'] . " -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} {$addparam} -o \"{$target}\" \"{$tempname1}\"");
        checkFile($target);
Пример #2
0
startPage();
if ($audioFormats[$index]['format'] == 'mp3' && $audioFiles->list[$sourceindex]->format == 'mp3') {
    if ($audioFormats[$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) {
        $tempname1 = getTempWavName();
        decodeWithLame("{$lame} --decode \"{$source}\" \"{$tempname1}\"");
        $tempname2 = getTempWavName();
        convertWithSox("{$sox} \"{$tempname1}\" -c2 \"{$tempname2}\"");
        unlink($tempname1);
        encodeWithLame("{$lame} --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname2}\" \"{$target}\"");
        unlink($tempname2);
    } else {
        encodeWithLame("{$lame} --disptime 1 --cbr --mp3input -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$source}\" \"{$target}\"");
    }
} elseif ($audioFormats[$index]['format'] == 'ogg' && $audioFiles->list[$sourceindex]->format == 'mp3') {
    $tempname1 = getTempWavName();
    decodeWithLame("{$lame} --decode \"{$source}\" \"{$tempname1}\"");
    if ($audioFormats[$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) {
        $tempname2 = getTempWavName();
        convertWithSox("{$sox} \"{$tempname1}\" -c2 \"{$tempname2}\"");
        unlink($tempname1);
        encodeWithOgg("{$oggenc} -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} -o \"{$target}\" \"{$tempname2}\"");
        unlink($tempname2);
    } else {
        if ($audioFormats[$index]['channels'] == 1 && $audioFiles->list[$sourceindex]->channels == 2) {
            $addparam = "--downmix";
        }
        encodeWithOgg("{$oggenc} -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} {$addparam} -o \"{$target}\" \"{$tempname1}\"");
        unlink($tempname1);
    }
} elseif ($audioFormats[$index]['format'] == 'mp3' && $audioFiles->list[$sourceindex]->format == 'ogg') {
    $tempname1 = getTempWavName();