Experimental support for M3U streams

This commit is contained in:
Pierre Rudloff 2016-12-26 15:50:26 +01:00
parent 1a6e995262
commit 28a8addbf1
5 changed files with 56 additions and 14 deletions

View file

@ -38,7 +38,12 @@ class Config
*
* @var array
*/
public $params = ['--no-playlist', '--no-warnings', '-f best[protocol^=http]', '--playlist-end', 1];
public $params = [
'--no-playlist', '--no-warnings',
//We can allow non-HTTP URLs on the feature/stream branch
'-f best',
'--playlist-end', 1
];
/**
* Enable audio conversion.

View file

@ -292,4 +292,28 @@ class VideoDownload
return popen($chain->getProcess()->getCommandLine(), 'r');
}
public function getM3uStream(\stdClass $video)
{
if (!shell_exec('which '.$this->config->avconv)) {
throw(new \Exception('Can\'t find avconv or ffmpeg'));
}
$procBuilder = ProcessBuilder::create(
[
$this->config->avconv,
'-v', 'quiet',
'-i', $video->url,
'-f', $video->ext,
'-c', 'copy',
'-bsf:a', 'aac_adtstoasc',
'-movflags', 'frag_keyframe+empty_moov',
'pipe:1',
]
);
//dump($procBuilder->getProcess()->getCommandLine()); die;
return popen($procBuilder->getProcess()->getCommandLine(), 'r');
}
}