php - Overlay image on video using FFMPEG

one text

Solution:

I solved the problem by using the following code:

// create temp file
$temp = new SplTempFileObject();

// get its file path
$tempPath = tempnam(sys_get_temp_dir(), $temp);

// open the file
$file = fopen($tempPath, "w");

// write the image to the temp file
$image->setImageFormat('png');
$image->writeImageFile($file);

// overlay the image using the temp file path
$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open($video);
$video
  ->filters()
  ->watermark($tempPath, array(
  'position' => 'absolute',
    'x' => $xOffset,
    'y' => $yOffset,
  ));

$video->save(new FFMpeg\Format\Video\X264(), 'output.mp4');

Source