Open Senya01 opened 1 year ago
I would very much want to see how you solve it... I ended up removing the audio from the video before generating the HLS files
This is my code
// the relative path of the video without output
$videoWithNoAudio =$this->video->id . '-no-audio.mp4';
// remove Audio from video before uploading
FFMpeg::fromFilesystem($this->video->disk)
->open($this->video->path)
->export()
->addFilter(['-an'])
->save($videoWithNoAudio);
// generate hls file
FFMpeg::fromFilesystem($this->video->disk)
->open($videoWithNoAudio)
->exportForHLS()
->setSegmentLength(10)
->toDisk('streamable_video')
->addFormat($highBitrate, function ($media) {
$media->scale(1920, 1080);
})
->addFormat($midBitrate, function ($media) {
$media->scale(1280, 720);
})
->addFormat($lowBitrate, function ($media) {
$media->scale(720, 480);
})
->save($this->video->id . '.m3u8');
I am sure there are better ways to do this.... but for now this is what works for me...
$convert->beforeSaving(function(array $commands) {
dd($commands);
//Identify position relative to audio parameter, and substitute ex: $commands[99] = "-an" return $commands; });
Hello,
How can I delete audio for hls? My code: