bibliophilsagar
bibliophilsagar

Reputation: 1753

To water mark videos at bottom right corner using ffmpeg

I found some answer here in stack which is indeed using ffmpeg but it is giving me some error.

I ran it in command window and the error is quite like

"Unable to find a suitable output format for 'ΓÇôi' ΓÇôi: Invalid argument".

my command is as follows

ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=(main_w-overlay_w-10)/2:(main_h-overlay_h-10)/2 [out]" outputvideo.mp4

please suggest some ideas.

Upvotes: 10

Views: 10597

Answers (3)

Rishik Rohan
Rishik Rohan

Reputation: 512

Basically overlay property defines where your watermark image will be posted -

main_w: video width
main_h: video height
overlay_w: overlay width
overlay_h: overlay height.

I guess 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";

Upvotes: 13

Dnyaneshwar
Dnyaneshwar

Reputation: 158

I tried with this command, and it worked for me. hope it will work for you as well.

$mark = "ffmpeg -i inputvideo.mp4 -i watermark.png -filter_complex  'overlay=x=(main_w-overlay_w):y=(main_h-overlay_h)' outputvideo.mp4";
exec($mark);

Upvotes: 7

Parthapratim Neog
Parthapratim Neog

Reputation: 4478

You can try these out. Should work out for you.

/*
 * At top left watermark
 */
$mark = "ffmpeg -i ".$inputvideo." -i logo.png -filter_complex ". '"overlay=x=(main_w-overlay_w)/(main_w-overlay_w):y=(main_h-overlay_h)/(main_h-overlay_h)"'." ".uniqid()."topleft.mp4";

/*
 * At top right watermark
 */
$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";

Upvotes: 9

Related Questions