Ejemplo n.º 1
0
foreach ($files_to_process as $key => $file) {
    // 		get the filename parts
    $filename = basename($file);
    $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
    echo '<strong>Processing ' . $filename . '</strong><br />';
    // 		set the input file
    $ok = $toolkit->setInputFile($file);
    // 		check the return value in-case of error
    if (!$ok) {
        // 			if there was an error then get it
        echo $toolkit->getLastError() . "<br /><br />\r\n";
        $toolkit->reset();
        continue;
    }
    // 		set the audio extraction settings
    $toolkit->extractAudio(PHPVideoToolkit::FORMAT_MP3, $samprate, $bitrate);
    // 		set the output details and overwrite if nessecary
    $ok = $toolkit->setOutput($audio_output_dir, $filename_minus_ext . '.mp3', PHPVideoToolkit::OVERWRITE_EXISTING);
    // 		check the return value in-case of error
    if (!$ok) {
        // 			if there was an error then get it
        echo $toolkit->getLastError() . "<br /><br />\r\n";
        $toolkit->reset();
        continue;
    }
    // 		execute the ffmpeg command and log the calls and ffmpeg results
    $result = $toolkit->execute(false, true);
    // 		get the last command given
    // 		$command = $toolkit->getLastCommand();
    // 		echo $command[0]."<br />\r\n";
    // 		echo $command[1]."<br />\r\n";