flac-to-ogg.php 506 B

1234567891011121314151617
  1. <?php
  2. $flacs = shell_exec('find "$(pwd)" -type f -name "*.flac"');
  3. $flacs_ex = preg_split("/\\r\\n|\\r|\\n/", $flacs);
  4. $flacs_total = sizeof($flacs_ex);
  5. $playlist = 'playlist.txt';
  6. for($i = 0; $i < $flacs_total - 1; $i++){
  7. $flac = $flacs_ex[$i];
  8. $ogg = str_replace('.flac', '.ogg', $flac);
  9. # Generating the list
  10. file_put_contents($playlist, $ogg . PHP_EOL, FILE_APPEND | LOCK_EX);
  11. # The conversion command
  12. shell_exec('ffmpeg -i "' . $flac . '" "' . $ogg . '"');
  13. }
  14. ?>