윈도우서버에서 ffmpge 호환성 개선

1. ffmpge 실행파일의 경로명에 공백이 들어가는 경우에도 실행가능하도록 수정

2.ffmpeg 실행시 상호작용을 명시적으로 비활성 옵션을 추가하여, mp4변환시 500에러가 발생하던 것을 수정
This commit is contained in:
ehii 2020-02-12 09:59:26 +09:00
parent 482985aa4a
commit 54ed209261
2 changed files with 19 additions and 4 deletions

View file

@ -1178,8 +1178,15 @@ class fileController extends file
$adjusted['height'] -= $adjusted['height'] % 2;
// Convert using ffmpeg
$command = $config->ffmpeg_command;
$command .= ' -i ' . escapeshellarg($file_info['tmp_name']);
if(strtoupper(substr(\PHP_OS, 0, 3)) === 'WIN')
{
$command = '"'.$config->ffmpeg_command.'"';
}
else
{
$command = $config->ffmpeg_command;
}
$command .= ' -nostdin -i ' . escapeshellarg($file_info['tmp_name']);
$command .= ' -movflags +faststart -pix_fmt yuv420p -c:v libx264 -crf 23';
$command .= sprintf(' -vf "scale=%d:%d"', $adjusted['width'], $adjusted['height']);
$command .= ' ' . escapeshellarg($output_name);