Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg overlay size

I have the following ffmpeg command which puts an overlay image over the video. After ffmpeg encoding is done the overlay image appears too big, bigger then it's actual size. How do i control width and height dimensions for the overlay image.

ffmpeg -i 1.wmv -s 640x360 -f mp4 -b 800k -acodec libfaac -ab 64k -vf "movie=0:png:dollar.png [wm];[in][wm] overlay=0:0:1 [out]" out.mp4
like image 886
Pinkie Avatar asked Nov 07 '11 17:11

Pinkie


People also ask

What is FFmpeg scale?

In FFmpeg, if you want to scale a video while retaining its aspect ratio, you need to set either one of the height or width parameter and set the other parameter to -1 . That is if you set the height , then set the width to -1 and vice-versa.

What is overlay FFmpeg?

FFmpeg offers the overlay filter as a way to overlay images (or even other videos) onto video streams. To centre overlay/watermark on a video, use this command: ffmpeg -i inputvideo.avi -i watermarklogo.png -filter_complex \ "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy output.flv.

Can FFmpeg resize images?

FFMpeg is using the libswscale library to resize the input. The libswscale library contains video image scaling and colorspace/pixelformat conversion routines. When we scale an image without specifying the size, the input dimension is used as the default value. We set the width of the output image to 250 pixels.


2 Answers

Try appending filter settings with scale=width:height clause like this:

ffmpeg -i 1.wmv -s 640x360 -f mp4 -b 800k -acodec libfaac -ab 64k -vf "movie=0:png:dollar.png, scale=120:120 [wm];[in][wm] overlay=0:0:1 [out]" out.mp4
like image 117
Alexey Nakonechny Avatar answered Nov 09 '22 19:11

Alexey Nakonechny


Try this worked for me : ffmpeg -i basevideo.xxx -vf "movie=overlayvid.xxx [in]; [in] scale=width:height [scale]; [in][scale] overlay=x:y [out]" output.xxx

like image 24
Aakash Avatar answered Nov 09 '22 21:11

Aakash