Conditions | 3 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
24 | 1 | public function makeThumbnails(string $videoFile, string $outputFile, float $time = 0.0, ?VideoFilterInterface $videoFilter = null): void |
|
25 | { |
||
26 | 1 | $this->ensureFileExists($videoFile); |
|
27 | |||
28 | 1 | if ($videoFilter === null) { |
|
29 | 1 | $videoFilter = new EmptyVideoFilter(); |
|
30 | } |
||
31 | |||
32 | 1 | $process = $this->ffmpegConfig->getProcess(); |
|
33 | |||
34 | 1 | $ffmpegCmd = $process->buildCommand( |
|
35 | [ |
||
36 | 1 | ($time > 0.0) ? sprintf('-ss %s', $time) : '', // putting time in front is much more efficient |
|
37 | 1 | sprintf('-i %s', escapeshellarg($videoFile)), // input filename |
|
38 | 1 | $videoFilter->getFFMpegCLIArgument(), // add -vf yadif,nlmeans |
|
39 | 1 | '-frames:v 1', |
|
40 | 1 | '-q:v 2', |
|
41 | 1 | '-y', // tell to overwrite |
|
42 | 1 | sprintf('%s', escapeshellarg($outputFile)), |
|
43 | ] |
||
44 | ); |
||
45 | |||
46 | 1 | $process->runCommand($ffmpegCmd); |
|
47 | 1 | } |
|
49 |