@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * We use ffprobe, ffmpeg and convert to analyse, transcode and manipulate videos and images (watermark) |
8 | 8 | */ |
9 | 9 | |
10 | -require_once __DIR__ . '/BasicTranscoder.php'; |
|
10 | +require_once __DIR__.'/BasicTranscoder.php'; |
|
11 | 11 | |
12 | 12 | use SA\CpeSdk; |
13 | 13 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->cpeLogger->log_out( |
104 | 104 | "INFO", |
105 | 105 | basename(__FILE__), |
106 | - "Input Video metadata: " . print_r($metadata, true), |
|
106 | + "Input Video metadata: ".print_r($metadata, true), |
|
107 | 107 | $this->activityLogKey |
108 | 108 | ); |
109 | 109 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $this->cpeLogger->log_out( |
141 | 141 | "ERROR", |
142 | 142 | basename(__FILE__), |
143 | - "Execution of command '".$ffmpegCmd."' failed: " . print_r($metadata, true). ". ".$e->getMessage(), |
|
143 | + "Execution of command '".$ffmpegCmd."' failed: ".print_r($metadata, true).". ".$e->getMessage(), |
|
144 | 144 | $this->activityLogKey |
145 | 145 | ); |
146 | 146 | return false; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | // Append output filename to path |
186 | - $pathToOutputFiles .= "/" . $outputWanted->{'output_file_info'}['basename']; |
|
186 | + $pathToOutputFiles .= "/".$outputWanted->{'output_file_info'}['basename']; |
|
187 | 187 | // Replace ${output_file} by output filename and path to local disk |
188 | 188 | $ffmpegCmd = preg_replace('/\$\{output_file\}/', $pathToOutputFiles, $ffmpegCmd); |
189 | 189 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | // Create FFMpeg arguments |
246 | - $ffmpegArgs = " -i $pathToInputFile -y -threads 0"; |
|
246 | + $ffmpegArgs = " -i $pathToInputFile -y -threads 0"; |
|
247 | 247 | $ffmpegArgs .= " -s $size"; |
248 | 248 | $ffmpegArgs .= " -vcodec $videoCodec"; |
249 | 249 | $ffmpegArgs .= " -acodec $audioCodec"; |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | $ffmpegArgs .= " $watermarkOptions"; |
255 | 255 | |
256 | 256 | // Append output filename to path |
257 | - $pathToOutputFiles .= "/" . $outputWanted->{'output_file_info'}['basename']; |
|
257 | + $pathToOutputFiles .= "/".$outputWanted->{'output_file_info'}['basename']; |
|
258 | 258 | // Final command |
259 | - $ffmpegCmd = "ffmpeg $ffmpegArgs $pathToOutputFiles"; |
|
259 | + $ffmpegCmd = "ffmpeg $ffmpegArgs $pathToOutputFiles"; |
|
260 | 260 | |
261 | 261 | return ($ffmpegCmd); |
262 | 262 | } |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | $snapshot_sec = $outputWanted->{'snapshot_sec'}; |
284 | 284 | } |
285 | 285 | |
286 | - $time = gmdate("H:i:s", $snapshot_sec) . ".000"; |
|
287 | - $pathToOutputFiles .= "/" . $outputFileInfo['basename']; |
|
286 | + $time = gmdate("H:i:s", $snapshot_sec).".000"; |
|
287 | + $pathToOutputFiles .= "/".$outputFileInfo['basename']; |
|
288 | 288 | $frameOptions = " -ss $time -vframes 1"; |
289 | 289 | } |
290 | 290 | else if ($outputWanted->{'mode'} == 'intervals') |
@@ -295,14 +295,14 @@ discard block |
||
295 | 295 | $intervals = $outputWanted->{'intervals'}; |
296 | 296 | } |
297 | 297 | |
298 | - $pathToOutputFiles .= "/" . $outputFileInfo['filename'] . "%06d." |
|
298 | + $pathToOutputFiles .= "/".$outputFileInfo['filename']."%06d." |
|
299 | 299 | . $outputFileInfo['extension']; |
300 | 300 | $frameOptions = " -vf fps=fps=1/$intervals"; |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Create FFMpeg arguments |
304 | - $ffmpegArgs = " -i $pathToInputFile -y -threads 0"; |
|
305 | - $ffmpegArgs .= " -vf scale=" . $outputWanted->{'size'}; |
|
304 | + $ffmpegArgs = " -i $pathToInputFile -y -threads 0"; |
|
305 | + $ffmpegArgs .= " -vf scale=".$outputWanted->{'size'}; |
|
306 | 306 | $ffmpegArgs .= " $frameOptions -f image2 -q:v 8"; |
307 | 307 | |
308 | 308 | // Final command |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $this->activityLogKey); |
334 | 334 | |
335 | 335 | // Transform watermark for opacity |
336 | - $convertCmd = "convert $watermarkPath -alpha on -channel A -evaluate Multiply " . $watermarkOptions->{'opacity'} . " +channel $newWatermarkPath"; |
|
336 | + $convertCmd = "convert $watermarkPath -alpha on -channel A -evaluate Multiply ".$watermarkOptions->{'opacity'}." +channel $newWatermarkPath"; |
|
337 | 337 | |
338 | 338 | try { |
339 | 339 | $out = $this->executer->execute($convertCmd, 1, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | // Format options for FFMpeg |
363 | 363 | $size = $watermarkOptions->{'size'}; |
364 | 364 | $positions = $this->get_watermark_position($watermarkOptions); |
365 | - $formattedOptions = "-vf \"movie=$newWatermarkPath, scale=$size [wm]; [in][wm] overlay=" . $positions['x'] . ':' . $positions['y'] . " [out]\""; |
|
365 | + $formattedOptions = "-vf \"movie=$newWatermarkPath, scale=$size [wm]; [in][wm] overlay=".$positions['x'].':'.$positions['y']." [out]\""; |
|
366 | 366 | |
367 | 367 | return ($formattedOptions); |
368 | 368 | } |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | $positions['y'] = $watermarkOptions->{'y'}; |
380 | 380 | } |
381 | 381 | if ($watermarkOptions->{'x'} < 0) { |
382 | - $positions['x'] = 'main_w-overlay_w' . $watermarkOptions->{'x'}; |
|
382 | + $positions['x'] = 'main_w-overlay_w'.$watermarkOptions->{'x'}; |
|
383 | 383 | } |
384 | 384 | if ($watermarkOptions->{'y'} < 0) { |
385 | - $positions['y'] = 'main_h-overlay_h' . $watermarkOptions->{'y'}; |
|
385 | + $positions['y'] = 'main_h-overlay_h'.$watermarkOptions->{'y'}; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | return ($positions); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | if (!isset($outputWanted->{'allow_upscale'}) || |
442 | 442 | $outputWanted->{'allow_upscale'} == 'false') |
443 | 443 | { |
444 | - $metadata->{'size'} = $metadata->width . 'x' . $metadata->height; |
|
444 | + $metadata->{'size'} = $metadata->width.'x'.$metadata->height; |
|
445 | 445 | $inputSize = $metadata->{'size'}; |
446 | 446 | $inputSizeSplit = explode("x", $inputSize); |
447 | 447 | $outputSizeSplit = explode("x", $size); |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | // # finally, progress is easy |
494 | 494 | $progress = 0; |
495 | 495 | if ($done) { |
496 | - $progress = round(($done/$duration)*100); |
|
496 | + $progress = round(($done / $duration) * 100); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | $this->cpeLogger->log_out( |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } |
529 | 529 | |
530 | 530 | $preset = $output_wanted->{"preset"}; |
531 | - $presetPath = __DIR__ . '/../../../presets/'; |
|
531 | + $presetPath = __DIR__.'/../../../presets/'; |
|
532 | 532 | |
533 | 533 | if (!($presetContent = file_get_contents($presetPath.$preset.".json"))) { |
534 | 534 | throw new CpeSdk\CpeException("Can't open preset file !", |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | $preset = $output->{"preset"}; |
555 | - $presetPath = __DIR__ . '/../../../presets/'; |
|
555 | + $presetPath = __DIR__.'/../../../presets/'; |
|
556 | 556 | |
557 | 557 | if (!($files = scandir($presetPath))) { |
558 | 558 | throw new CpeSdk\CpeException("Unable to open preset directory '$presetPath' !", |