mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 09:01:42 -04:00
20 lines
1.0 KiB
PHP
20 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Services;
|
|
|
|
class VideoService
|
|
{
|
|
public static function copyAndRescale(string $pathToVie, string $pathToOutputFile, int $scale = 1280): self
|
|
{
|
|
exec("ffmpeg -i $pathToVie -vf scale=$scale:-1 $pathToOutputFile", $output, $resultCode);
|
|
|
|
return new static;
|
|
}
|
|
|
|
public static function concat(string $intro, string $pathToVideo, string $pathToOutput, string $outro = ''): void
|
|
{
|
|
$newOutro = $outro ?: $intro;
|
|
`ffmpeg -i "$intro" -i "$pathToVideo" -i "$newOutro" -filter_complex "[0:v]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1,setsar=1,fps=30,format=yuv420p[v0];[1:v]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1,setsar=1,fps=30,format=yuv420p[v1];[2:v]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1,setsar=1,fps=30,format=yuv420p[v2];[v0][0:a][v1][1:a][v2][2:a]concat=n=3:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -c:a aac -movflags +faststart "$pathToOutput"`;
|
|
}
|
|
}
|