1. Go to this page and download the library: Download clearcut/clearcut-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clearcut / clearcut-laravel example snippets
Route::group(['middleware' => ['jwt.verify', 'admin']], function () {
// ...the panel's own routes...
Route::prefix('recordings')->group(function () {
use Clearcut\Video\ClearcutClient;
use Clearcut\Video\Data\JobRequest;
public function __construct(private ClearcutClient $clearcut) {}
$status = $this->clearcut->process(new JobRequest(
videoId: (string) $recording->id,
sourceKey: $recording->storage_key, // a bucket key, not a URL
mode: JobRequest::MODE_AUTO,
brand: 'acme',
));
// Minutes, so poll rather than wait.
$status = $this->clearcut->job($status->jobId);
$status->finished(); // done | failed | cancelled
use Clearcut\Video\Data\BatchRequest;
$batch = $this->clearcut->processBatch(BatchRequest::of(
['12' => 'media/originals/12/source.mp4',
'13' => 'media/originals/13/source.mp4'],
new JobRequest(
videoId: 'unused-by-the-batch', // each recording carries its own
sourceKey: 'unused-by-the-batch',
mode: JobRequest::MODE_AUTO,
brand: 'acme',
),
));
$batch = $this->clearcut->batch($batch->batchId); // the whole batch, one request
$batch->progress; // 0..1, weighted by each recording's length
$batch->failures(); // the recordings that need redoing
$batch->successes(); // keep these — they are finished encodes
$analysis = $this->clearcut->analyze($request); // detect only
$proposal = $this->clearcut->proposal($analysis->jobId);
$this->clearcut->decide($analysis->jobId, ['pan-0' => 'kept']);
// Correct a box, or draw one detection missed. Both return the region as saved.
$this->clearcut->editRegion($analysis->jobId, 'pan-0', ['w' => 240, 't1' => 12.5]);
$this->clearcut->addRegion($analysis->jobId, x: 40, y: 300, w: 200, h: 36, t0: 4.0, t1: 9.0);
$encode = $this->clearcut->apply($analysis->jobId, brand: 'acme');
$this->clearcut->brands(); // what this deployment can watermark with
$this->clearcut->profiles(); // speed against thoroughness
$this->clearcut->health(); // reachable? which binaries resolved?
app(Clearcut\Video\BrandLabels::class)->labelFor('acme'); // 'Acme', or 'acme' when unknown
app(Clearcut\Video\BrandLabels::class)->has('acme');