class ProcessNewVideo extends Job implements ShouldQueue

Traits

SerializesModels
InteractsWithQueue
Queueable
Dispatchable

Properties

int $tries

The number of times the job may be attempted.

Video $video

The new video that should be processed.

protected $ffmpegVideo

The FFMpeg video instance.

protected FFProbe|null $ffprobe

The FFProbe instance.

protected bool $deleteWhenMissingModels

Ignore this job if the video does not exist any more.

Methods

__construct(Video $video)

Create a new instance.

void
handle()

Execute the job.

handleFile(Video $file, string $path)

Process a cached video file.

string
getCodec(string $url)

Get the codec of a video

float
getVideoDuration(string $path)

Get the duration of the video.

Dimension
getVideoDimensions(string $url)

Get the dimensions of a video

extractImagesfromVideo(string $path, float $duration, $destinationPath)

Extract images from video.

generateVideoThumbnails($disk, $fragment, $tmpDir)

No description

void
generateSnapshots(string $sourcePath, float $frameRate, string $targetDir)

Run the actual command to extract snapshots from the video. Separated into its own method for easier testing.

Image
generateThumbnail(string $file, int $width, int $height)

Generate a thumbnail from a video snapshot. Separated into its own method for easier testing.

Details

at line 65
__construct(Video $video)

Create a new instance.

Parameters

Video $video

The video that should be processed.

at line 75
void handle()

Execute the job.

Return Value

void

at line 112
handleFile(Video $file, string $path)

Process a cached video file.

Parameters

Video $file
string $path

at line 187
protected string getCodec(string $url)

Get the codec of a video

Parameters

string $url

URL/path to the video file

Return Value

string

at line 207
protected float getVideoDuration(string $path)

Get the duration of the video.

Parameters

string $path

Video file path.

Return Value

float

Duration in seconds.

at line 221
protected Dimension getVideoDimensions(string $url)

Get the dimensions of a video

Parameters

string $url

URL/path to the video file

Return Value

Dimension

at line 239
protected extractImagesfromVideo(string $path, float $duration, $destinationPath)

Extract images from video.

Parameters

string $path

Path to the video file.

float $duration

Duration of video in seconds.

$destinationPath

Path to where images will be saved.

Exceptions

Exception

at line 258
generateVideoThumbnails($disk, $fragment, $tmpDir)

No description

Parameters

$disk
$fragment
$tmpDir

at line 312
protected void generateSnapshots(string $sourcePath, float $frameRate, string $targetDir)

Run the actual command to extract snapshots from the video. Separated into its own method for easier testing.

Parameters

string $sourcePath
float $frameRate
string $targetDir

Return Value

void

at line 325
protected Image generateThumbnail(string $file, int $width, int $height)

Generate a thumbnail from a video snapshot. Separated into its own method for easier testing.

Parameters

string $file
int $width
int $height

Return Value

Image