Skip to content

Instantly share code, notes, and snippets.

@qant
Created July 9, 2023 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qant/5c5b8344e84aebfca1c050f40a990305 to your computer and use it in GitHub Desktop.
Save qant/5c5b8344e84aebfca1c050f40a990305 to your computer and use it in GitHub Desktop.
ffmpeg bulk video decoder
<?php
$inputFolder = '/path';
$outputFolder = '/path_output';
$files = glob($inputFolder . '/*');
foreach ($files as $file) {
$filename = pathinfo($file, PATHINFO_FILENAME);
$command = "ffmpeg -i \"$file\" -vf \"scale=-1:720\" -crf 23 -preset medium -c:v libx264 -c:a aac -b:a 128k \"$outputFolder/$filename.mkv\"";
exec($command);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment