[FFmpeg-user] R: Re: Use ffmpeg to watermark and scale an image on video
daad at libero.it
daad at libero.it
Tue Nov 22 23:18:51 CET 2011
doesn't it scale the video instead?
i need the image to be scaled.
in the meantime i came up with the following script:
VIDEO_WIDTH=`ffprobe -show_streams $VIDEO 2>&1 | grep ^width | sed s/width=//`
echo The video width is $VIDEO_WIDTH
cp $LOGO logo.png
echo The image width will be $IMAGE_WIDTH
mogrify -resize $IMAGE_WIDTH logo.png
echo logo.png resized
echo Starting watermarking
ffmpeg -i $VIDEO -sameq -acodec copy -vf 'movie=logo.png [watermark]; [in]
[watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]'
echo Video watermarked
The last thing i'm not sure about is, why the watermarked video is smaller in
size compared to the original. I thought that using "-sameq" would just keep
the original video quality.
If i specify "-vcodec copy" then the watermark bit is not applied, hence I
thought to use "-sameq".
Duration: 00:01:25.53, start: 0.000000, bitrate: 307 kb/s
Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p, 640x480 [SAR 1:1 DAR 4:3], 261 kb/s, 10 fps, 10 tbr, 3k tbn, 25 tbc
encoder : Lavf53.20.0
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:
1 DAR 4:3], q=-1--1, 10 tbn, 10 tbc
whereas the audio info information are identical.
any advice on how to use the same video quality as well?
>Da: alex.zhen.ma at gmail.com
>Data: 22/11/2011 22.57
>A: "FFmpeg user questions and RTFMs"<ffmpeg-user at ffmpeg.org>
>Ogg: Re: [FFmpeg-user] Use ffmpeg to watermark and scale an image on video
>It should work with this way.
>ffmpeg -i sample.mov -sameq -acodec copy -vf
>[watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]'
>On Tue, Nov 22, 2011 at 4:13 PM, daad at libero.it <daad at libero.it> wrote:
>> I want to be able to watermark videos with a logo image, which contains a
>> website url. The videos can be of different formats and dimension. I'm
>> to figure out a generic ffmpeg command to achieve it, so that i don't have
>> tweak the command depending on the video i have to process. So far i got:
>> ffmpeg -i sample.mov -sameq -acodec copy -vf 'movie=logo.png [watermark];
>> [watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]'
>> In this way though the logo will look too big or too small with video of
>> different size. I've seen there is a scale option for avfilter but that
>> scale the video, not the watermarked image (i guess?), but I haven't
>> figure out
>> whether it's possible to resize the image logo based on the dimension of
>> input video, so that I can say to scale the logo width to 1/3 of the video
>> width for example, and keep the image ratio.
>> Any idea? doesn't need to be done in a single command, could even be a
>> thanks in advance.
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>Your sincerely !
>Alex Zhen Ma
>▪ Email: alex.zhen.ma at gmail.com
>ffmpeg-user mailing list
>ffmpeg-user at ffmpeg.org
More information about the ffmpeg-user