Created
November 17, 2021 22:00
-
-
Save NandoKstroNet/23b79290a9fbd0ce1b64898998fff8f7 to your computer and use it in GitHub Desktop.
Trecho de Processamento de Video em HLS para nosso projeto VideoFlix do curso Laravel Mastery em https://laravelmastery.com.br
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$video = 'videos/Q4tdrMHQLB4mJ3mR2BzgbIaWNoa5rHB19rOtTpVf.mp4'; | |
$videoProcessed = 'processed/Q4tdrMHQLB4mJ3mR2BzgbIaWNoa5rHB19rOtTpVf.m3u8'; | |
$lowBitrateFormat = (new X264)->setKiloBitrate(500); | |
$midBitrateFormat = (new X264)->setKiloBitrate(1500); | |
$highBitrateFormat = (new X264)->setKiloBitrate(3000); | |
FFMpeg::fromDisk('public') | |
->open($video) | |
->exportForHLS() | |
->addFormat($lowBitrateFormat) | |
->addFormat($midBitrateFormat) | |
->addFormat($highBitrateFormat) | |
->onProgress(function ($progress) { | |
$this->info("Progress= {$progress}%"); | |
}) | |
->toDisk('public') | |
->save($videoProcessed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment