Skip to content

Instantly share code, notes, and snippets.

@cryptixcoder
Created December 2, 2015 21:26
Show Gist options
  • Save cryptixcoder/9a2c3c1f453d5011654e to your computer and use it in GitHub Desktop.
Save cryptixcoder/9a2c3c1f453d5011654e to your computer and use it in GitHub Desktop.
duration of a video
$ffmpeg_output = shell_exec("ffmpeg -i \"$file\" 2>&1");
if( preg_match('/.*Duration: ([0-9:]+).*/', $ffmpeg_output, $matches) ) {
echo $matches[1];
} else {
echo "$file failed\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment