bitRate, FILTER_SANITIZE_NUMBER_INT); header('Content-Type: audio/mpeg'); header('Content-Disposition: attachment; filename="'.basename($this->song->path).'"'); $args = [ '-i '.escapeshellarg($this->song->path), '-map 0:0', '-v 0', "-ab {$bitRate}k", '-f mp3', '-', ]; if ($this->startTime) { array_unshift($args, "-ss {$this->startTime}"); } passthru("$ffmpeg ".implode($args, ' ')); } public function setBitRate(int $bitRate): void { $this->bitRate = $bitRate; } public function setStartTime(float $startTime): void { $this->startTime = $startTime; } }