Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to add a PNG watermark and then scale my video. I may add more filters. This is my FFmpeg command.

sweb@sweb-laptop:/tmp$ ffmpeg -i Wildlife.wmv -sn -acodec libvorbis -vcodec libvpx -b:a 128k -ar 44100 -b:v 384k -r 25 -vf "movie=/tmp/icon.png [watermark]; [in][watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2 [out], scale=480:-1" video.webm

… but it gave me an error:

Simple filtergraph 'movie=/tmp/icon.png [watermark]; [in][watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2 [out], scale=480:-1' does not have exactly one input and output.
Error opening filters!
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted
[in][watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2 [out], scale=480:-1"

..has [out] in the wrong place, which renders the filtergraph meaningless. It should be:

[in][watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2, scale=480:-1[out]"

Personally I dislike the movie filter, for purely aesthetic reasons (I think it makes the command-line look less clear). I would do this using filter_complex instead:

ffmpeg -i Wildlife.wmv -i /tmp/icon.png \
-filter_complex '[0:v][1]overlay=W/2-w/2:H/2-h/2,scale=480:-1[outv]' \
-map [outv] -map 0:a -c:a libvorbis -b:a 128k -c:v libvpx -b:v 384k output.webm

Note that filter_complex is incompatible with [in], since by its nature it takes multiple inputs.

I've removed -ar 44100 and -r 25, since you probably don't need them - if your input source has a frame rate of 25fps and an audio rate of 44100, the output will inherit those settings by default. And if it doesn't, you probably won't gain anything by changing them.


To scale the video first, and then add a watermark, you could use something like this:

-vf 'movie=/tmp/icon.png[wm];[in]scale=480:-1[int];[int][wm]overlay=W/2-w/2:H/2-h/2[out]'

I'm not actually sure if that would work; personally, I'd use filter_complex, as above:

ffmpeg -i Wildlife.wmv -i /tmp/icon.png \
-filter_complex '[0:v]scale=480:-1[int];[int][1]overlay=W/2-w/2:H/2-h/2[outv]' \
-map [outv] -map 0:a -c:a libvorbis -b:a 128k -c:v libvpx -b:v 384k output.webm
share|improve this answer
    
if i wanna first scale and then add water mark what must i do? [in][watermark] scale=480:-1,overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2[out] did not work. –  sweb Feb 5 '13 at 19:16
    
can you aid me to solve it ? –  sweb Feb 5 '13 at 19:24
1  
@sweb I've appended instructions on how to do that onto the answer –  evilsoup Feb 5 '13 at 19:44
    
ty again for great aid man. –  sweb Feb 5 '13 at 19:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.