laravel-ffmpeg icon indicating copy to clipboard operation
laravel-ffmpeg copied to clipboard

exportForHLS not support for mp3

Open phuongphally opened this issue 4 years ago • 4 comments

Hello sir. This library work great for export video to exportForHLS , but not mp3

I wrote


 $lowBitrate = (new \FFMpeg\Format\Audio\Aac)->setAudioKiloBitrate(64);
            $midBitrate = (new \FFMpeg\Format\Audio\Aac)->setAudioKiloBitrate(128);
            $highBitrate = (new \FFMpeg\Format\Audio\Aac)->setAudioKiloBitrate(265);

            FFMpeg::fromDisk(config('app.upload_storage'))
                ->open('idol.mp3')
                ->exportForHLS()
                ->setSegmentLength(10) // optional
                ->addFormat($lowBitrate)
                ->addFormat($midBitrate)
                ->addFormat($highBitrate)
                ->toDisk(config('app.stream_storage'))
                ->save('idol.m3u8');

Get error

//Argument 2 passed to ProtoneMedia\\LaravelFFMpeg\\Exporters\\HLSExporter::getSegmentPatternAndFormatPlaylistPath() must be an instance of FFMpeg\\Format\\VideoInterface, instance of FFMpeg\\Format\\Audio\\Mp3 given, called in ..../vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSExporter.php on line 261


phuongphally avatar May 15 '21 05:05 phuongphally

Similar https://github.com/protonemedia/laravel-ffmpeg/issues/115

phuongphally avatar May 15 '21 06:05 phuongphally

@pascalbaljet Please help me.

phuongphally avatar May 20 '21 08:05 phuongphally

addFormat is dedicated for video formats! if you want to modify the audio codec and/or bitrate, use this as an example: $highBitrate = (new X264)->setAudioKiloBitrate(320)->setKiloBitrate(1000)->setAudioCodec('aac');

theMSY avatar Jul 06 '21 16:07 theMSY

->setSegmentLength(10)

did you find a solution?

nemesisKO avatar Nov 30 '21 14:11 nemesisKO

Any updates?

Senya01 avatar Nov 20 '22 20:11 Senya01

Fixed in v8.2.1

pascalbaljet avatar Jan 12 '23 09:01 pascalbaljet