Closed egyjs closed 1 year ago
Hi @egyjs I use a trait or can use this code
FFMpeg::fromDisk()->open($video->path)->getAdvancedDriver()->getVideoStream();
follow trait below:
hi @Jandelson, how are you i found the issue recently, and i fix it but i dont know how 😃 , i was creating a Class with this structure:
$ffmpeg
$this->ffmpeg = FFMpeg::fromDisk($video_disk)->open($video)
in other methods I try to use the $this->ffmpeg
like this, for example: getThumbnail()
public function getThumbnail($video = null): string
{
if ($video == null) {
return $this->video_thumbnail;
}
// laravel-ffmpeg
$thumbnail = md5($video.uniqid()) . '.jpg';
return $this->ffmpeg->getFrameFromSeconds(round($this->getVideoDuration() / 2))
->export()
->toDisk($this->final_disk)
->withVisibility('public')
->save($this->final_path.$thumbnail);;
}
then the method after that generateResolutions()
public function generateResolutions()
{
$format = X264::class;
$lowBitrate = (new $format)->setKiloBitrate(250);
$midBitrate = (new $format)->setKiloBitrate(500);
$highBitrate = (new $format)->setKiloBitrate(1000);
$superBitrate = (new $format)->setKiloBitrate(1500);
$this->ffmpeg
->exportForHLS()
->addFormat($lowBitrate, fn (HLSExporter $media) => $media->resize(640, 480))
->addFormat($midBitrate, fn (HLSExporter $media) => $media->resize(960, 720))
->addFormat($highBitrate, fn (HLSExporter $media) => $media->resize(1280, 960))
->addFormat($superBitrate, fn (HLSExporter $media) => $media->resize(1920, 1440))
// ->toDisk($this->disk)
->dd('adaptive_steve.m3u8');
return $this;
}
getThumbnail()
:
- return $this->ffmpeg->getFrameFromSeconds(round($this->getVideoDuration() / 2))
+ $this->ffmpeg = $this->ffmpeg->getFrameFromSeconds(round($this->getVideoDuration() / 2))
in generateResolutions()
:
- $this->ffmpeg
- ->exportForHLS()
- ->addFormat($lowBitrate, fn (HLSExporte #...
+ $this->ffmpeg = $this->ffmpeg
+ ->exportForHLS()
+ ->addFormat($lowBitrate, fn (HLSExporte #...
https://flareapp.io/share/x5Mo9zMP#F79L39
code