Closed pzanwar03 closed 3 years ago
What's the problem and how does your solution solve it?
When using HLS if I set a format as follows:
$lowBitrateFormat = (new X264('aac','libx264'))->setKiloBitrate(200)->setAdditionalParameters([
"-preset",
"ultrafast",
"-r",
16.667
]);
I get the following error, which I think is what @pzanwar03 is referring to – line 34 of HLSPlaylistGenerator.php.
ErrorException: A non well formed numeric value encountered in /Users/johnpuddephatt/Sites/mimi2/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSPlaylistGenerator.php:34
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'A non well form...', '/Users/johnpudd...', 34, Array)
#1 /Users/johnpuddephatt/Sites/mimi2/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSPlaylistGenerator.php(34): number_format('50/3', 3, '.', '')
#2 /Users/johnpuddephatt/Sites/mimi2/vendor/pbmedia/laravel-ffmpeg/src/Exporters/HLSPlaylistGenerator.php(72): ProtoneMedia\LaravelFFMpeg\Exporters\HLSPlaylistGenerator->getFrameRate(Object(ProtoneMedia\LaravelFFMpeg\MediaOpener))
...
Worth mentioning that I'm only seeing this error after upgrading to version 7 – if I remove setAdditionalParameters it processes as expected.
Yes, @johnpuddephatt is right
A workaround seems to be to not set the framerate through additionalParameters but instead to do it with a custom filter, e.g.
$lowBitrateFormat = (new X264('aac','libx264'))->setKiloBitrate(200);
...
...
...
->addFormat($lowBitrateFormat, function($media){
$media->addFilter(function ($filters, $in, $out) {
$filters->custom($in, "fps=20", $out); // $in, $parameters, $out
});
})
I've manually verified that the outputted video files(s) match the value sat for fps. I can't work out whether there's any substantial difference between setting the framerate with the -r
flag vs the fps
filter, but having read this post on StackOverflow I can't interpret any difference.
I just tagged v7.5.8 which should solve this problem.
Hello Admin,
I got some problem converting HLS. I've fix it could you please fix the problem in the package.
Problem Line number: vendor\pbmedia\laravel-ffmpeg\src\Exporters\HLSPlaylistGenerator.php:34
We need add (int) before $frameRate variable.
Also, I've uploaded a video that I got the problem convertingHLS.
https://user-images.githubusercontent.com/25006760/110253453-98d70000-7fb4-11eb-8d70-c3c71341210e.mp4