Created
July 5, 2019 13:09
-
-
Save Domin8-IPTV/21edbc0d38044739e705dcfb142b3075 to your computer and use it in GitHub Desktop.
convert avi to mp4 using ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
declare(strict_types = 1); | |
if ($argc !== 2) { | |
fprintf ( STDERR, "usage: %s dir\n", $argv [0] ); | |
die ( 1 ); | |
} | |
$dir = rtrim ( $argv [1], DIRECTORY_SEPARATOR ); | |
if (! is_readable ( $dir )) { | |
fprintf ( STDERR, "supplied path is not readable! (try running as an administrator?)" ); | |
die(1); | |
} | |
if (! is_dir ( $dir )) { | |
fprintf ( STDERR, "supplied path is not a directory!" ); | |
die(1); | |
} | |
$files = glob ( $dir . DIRECTORY_SEPARATOR . '*.avi' ); | |
foreach ( $files as $file ) { | |
system ( "ffmpeg -i " . escapeshellarg ( $file ) . ' ' . escapeshellarg ( $file . '.mp4' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment