HLS Live() method error
aolee opened this issue · 1 comments
aolee commented
Hi everyone, need your guidance, not sure if it's me (well most likely yes I guess) or there is a bug.
I haven't seen anyone use the ->live() method yet so please forgive me if I'm being noob.
Here is my code and I wanted to stream the live channel from akamai below. (cant find a live RTMP so trying the live m3u8 first as input)
<?php
require '../vendor/autoload.php';
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
$config = [
'ffmpeg.binaries' => '/usr/bin/ffmpeg',
'ffprobe.binaries' => '/usr/bin/ffprobe',
'timeout' => 3600, // The timeout for the underlying process
'ffmpeg.threads' => 12, // The number of threads that FFmpeg should use
];
$log = new Logger('FFmpeg_Streaming');
$log->pushHandler(new StreamHandler('/var/log/ffmpeg-streaming.log')); // path to log file
$ffmpeg = Streaming\FFMpeg::create($config, $log);
$INHTTP = "https://moctobpltc-i.akamaihd.net/hls/live/571329/eight/playlist.m3u8";//protocol
$video = $ffmpeg->open($INHTTP);
$video->setMasterPlaylist('/usr/share/nginx/html/mydomain.com/public/live-master-manifest.m3u8')
->live('https://my.domain.com/world/world.m3u8');
But it's giving me an error
$ php test.php
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'FFMpeg\Media\Video' does not have a method 'setMasterPlaylist' in /usr/share/nginx/html/mydomain.com/vendor/aminyazdanpanah/php-ffmpeg-video-streaming/src/Media.php on line 100
PHP Fatal error: Uncaught Error: Call to a member function live() on null in /usr/share/nginx/html/mydomain.com/test/test.php:41
Stack trace:
#0 {main}
thrown in /usr/share/nginx/html/mydomain.com/test/test.php on line 41
I have checked the '/var/log/ffmpeg-streaming.log' and ffprobe seems to working.
aminyazdanpanah commented
You missed ->hls()
require '../vendor/autoload.php';
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
$config = [
'ffmpeg.binaries' => '/usr/bin/ffmpeg',
'ffprobe.binaries' => '/usr/bin/ffprobe',
'timeout' => 3600, // The timeout for the underlying process
'ffmpeg.threads' => 12, // The number of threads that FFmpeg should use
];
$log = new Logger('FFmpeg_Streaming');
$log->pushHandler(new StreamHandler('/var/log/ffmpeg-streaming.log')); // path to log file
$ffmpeg = Streaming\FFMpeg::create($config, $log);
$INHTTP = "https://moctobpltc-i.akamaihd.net/hls/live/571329/eight/playlist.m3u8";//protocol
$video = $ffmpeg->open($INHTTP);
$video->hls()->setMasterPlaylist('/usr/share/nginx/html/mydomain.com/public/live-master-manifest.m3u8')
->live('https://my.domain.com/world/world.m3u8');