Skip to content

Instantly share code, notes, and snippets.

@rmcdaniel
Created October 31, 2022 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmcdaniel/f1a9900f7493326571a37b897b35393e to your computer and use it in GitHub Desktop.
Save rmcdaniel/f1a9900f7493326571a37b897b35393e to your computer and use it in GitHub Desktop.
<?php
namespace App\Workflows\ConvertVideo;
use FFMpeg\FFMpeg;
use FFMpeg\Format\Video\WebM;
use Workflow\Activity;
class ConvertVideoWebmActivity extends Activity
{
public $timeout = 5;
public function execute($input, $output)
{
$ffmpeg = FFMpeg::create();
$video = $ffmpeg->open($input);
$format = new WebM();
$format->on('progress', fn () => $this->heartbeat());
$video->save($format, $output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment