$hlsPath = $uploadPath . '/hls/';
FileHelper::createDirectory($hlsPath);
$hlsMaster = $hlsPath . 'master.m3u8';
$cmd = "ffmpeg -i {$originalPath} " .
"-c:v libx264 -c:a aac -strict experimental " .
"-f hls " .
"-movflags +faststart " .
"-hls_time 10 " .
"-hls_list_size 0 " .
"-hls_segment_filename {$hlsPath}segment_%03d.ts " .
"{$hlsMaster} 2>&1";
exec($cmd, $output, $returnCode);