php - ffmpeg watermark transparent background -


i'm trying add watermark video file i'm having problems background of watermark because want transparent.

my approach this: make png file size of video transparent background this

$im = imagecreatetruecolor($width, $height);  $almostblack = imagecolorallocate($im,254,254,254);  imagefill($im,0,0,$almostblack);  $black = imagecolorallocate($im,0,0,0);  imagecolortransparent($im,$almostblack);   $textcolor = imagecolorallocate($im, 255, 0, 0);  // write string @ top left imagestring($im, 5, 0, 0, 'hello world!', $textcolor);  imagepng($im, $img); imagedestroy($im); 

and add video this

exec("/usr/bin/ffmpeg -y -i '$file->path' -sameq -vf 'movie=$img [logo]; [in][logo] overlay=main_w-overlay_w:main_h-overlay_h [out]' '$new_path'"); 

the watermark added it's background not transparent.

any idea i'm doing wrong ?

update: turns out works fine other png images problem must in way build png file ideas why doesn't work way ?


Comments