laravel-ffmpeg
laravel-ffmpeg copied to clipboard
Add a way to set the encryption key static
Instead of dynamic hls, why isn't there options for static? It will greatly improve this package as all the parts can be served with nginx. Something like :
FFMpeg::fromDisk('uploads')
->open("{$this->argument('video')}.mp4")
->exportForHLS()
->addFormat($lowFormat, function (HLSVideoFilters $filters) {
$filters->resize(1280, 720);
})
->setKeyUrlResolver(function ($key) {
return ...;
})
->addFormat($midFormat, function (HLSVideoFilters $filters) {
$filters->resize(1920, 1080);
})
->addFormat($highFormat, function (HLSVideoFilters $filters) {
// this will keep the original resolution but convert with higher bitrate
})
->withRotatingEncryptionKey(function ($filename, $contents) {
Storage::disk('secrets')->put($filename, $contents);
}, 30)
->onProgress(function ($progress) {
$this->info("Progress: {$progress}%");
})
->toDisk('public')
->save("videos/{$this->argument('video')}.m3u8");
I can create a PR if needed