Skip to content

Commit

Permalink
Find better FFmpeg path
Browse files Browse the repository at this point in the history
And set to a function for better readability
  • Loading branch information
pH-7 committed Feb 7, 2016
1 parent 1a3d6f3 commit 4716439
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _install/controllers/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function config_system ()
$_SESSION['db']['charset'] = 'UTF8';

$_SESSION['val']['bug_report_email'] = '';
$_SESSION['val']['ffmpeg_path'] = (is_windows() ? 'C:\ffmpeg\ffmpeg.exe' : (is_file('/usr/local/bin/ffmpeg') ? '/usr/local/bin/ffmpeg' : '/usr/bin/ffmpeg'));
$_SESSION['val']['ffmpeg_path'] = ffmpeg_path();
}

if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['config_system_submit']))
Expand Down
15 changes: 15 additions & 0 deletions _install/inc/fns/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,21 @@ function generate_hash($iLength = 80)
return substr(hash('whirlpool', time() . hash('sha512', getenv('REMOTE_ADDR') . uniqid(mt_rand(), true) . microtime(true)*999999999999)), 0, $iLength);
}

/**
* Try to find and get the FFmpeg path if it is installed (note I don't use system command like "which ffmpeg" for portability reason).
*
* @return string The appropriate FFmpeg path.
*/
function ffmpeg_path()
{
if (is_windows())
$sPath = (is_file('C:\ffmpeg\bin\ffmpeg.exe')) ? 'C:\ffmpeg\bin\ffmpeg.exe' : 'C:\ffmpeg\ffmpeg.exe';
else
$sPath = (is_file('/usr/local/bin/ffmpeg')) ? '/usr/local/bin/ffmpeg' : '/usr/bin/ffmpeg';

return $sPath;
}

/**
* Check if Apache's mod_rewrite is installed.
*
Expand Down

0 comments on commit 4716439

Please sign in to comment.