Basically, the overlay property determines where your watermark image will be placed -
main_w: video width main_h: video height overlay_w: overlay width overlay_h: overlay height.
I think this should work fine.
$mark = "ffmpeg -i ".$inputvideo." -i logo.png -filter_complex ". '"overlay=x=(main_w-overlay_w):y=(main_h-overlay_h)/(main_h-overlay_h)"'." ".uniqid()."topright.mp4";
source share