Closed shankar-bavan closed 3 years ago
Maybe the $reps->getCalculatedReps()
is an empty array and then the getHeight()
does not exist.
You should debug your code to find out the error!
You can also write an 'if condition' to avoid this error:
$reps = new AutoReps($video, $format, [360, 480, 720, 1080]);
$representations = (count($reps->getCalculatedReps() > 0) ? $reps->getCalculatedReps() : $reps->getOriginalRep();
$video->hls()
->encryption($save_to, $url, 1)
->setFormat($format)
->setHlsTime(5) // Set Hls Time. Default value is 10
->setHlsAllowCache(false)
->addRepresentations($representations )
->save($save_path);
I getting following error when I convert 240p videos.
ERROR: Call to a member function getHeight() on null {"exception":"[object] (Error(code: 0): Call to a member function getHeight() on null at vendor/aminyazdanpanah/php-ffmpeg-video-streaming/src/HLS.php:305
aminyazdanpanah/php-ffmpeg-video-streaming: "^1.2", (1.2.12) ffmpeg version 4.2.4-1ubuntu0.1