protonemedia / laravel-ffmpeg

This package provides an integration with FFmpeg for Laravel. Laravel's Filesystem handles the storage of the files.
https://protone.media/en/blog/how-to-use-ffmpeg-in-your-laravel-projects
MIT License
1.63k stars 194 forks source link

hls errors if you pass audio only #461

Closed aronquiray closed 1 year ago

aronquiray commented 1 year ago

This solves the problem when you only want to generate hls from an mp3. Basically, MP3 doesn't have video, the code is as is,

$low = (new X264)->setAudioKiloBitrate(96);
        $med = (new X264)->setAudioKiloBitrate(128);
        $high = (new X264)->setAudioKiloBitrate(256);
        $ultra = (new X264)->setAudioKiloBitrate(320);

        FFMpeg::fromDisk(config('filesystems.default'))
            ->open($storageLocation) // MP3 file
            ->exportForHLS()
            ->addFormat($low)
            ->addFormat($med)
            ->addFormat($high)
            ->addFormat($ultra)
            ->setSegmentLength(10)
            ->save($toLocation); //m3u8

take note, I am only passing an MP3 file, here, you can still specify the AudioKB

joserick commented 1 year ago

@pascalbaljet Could you please approve this? I'm having the same problem as mentioned in #460 for months now, when converting audio to M3u8.

By the way, @aronquiray thank you very much.

pascalbaljet commented 1 year ago

Thanks!

pascalbaljet commented 1 year ago

I've tagged v8.2.1 with the fix.

aronquiray commented 1 year ago

thanks @pascalbaljet and you're welcome @joserick