Reputation: 561
How do I scale an image and place it over a video using ffmpeg
?
Using a script below I get an error Invalid stream specifier: wm.
.
ffmpeg.exe -i img0.png -i vid1.mp4 -i vid2.mp4 -i vid3.mp4 -filter_complex_script fcs.txt
-map [outv] -map [outa] out.mp4
fcs.txt:
[0:v]scale=-1:128[wm];
[1:v]gblur=sigma=30:steps=5[bg1];
[1:v]scale=-1:1080,eq=saturation=1.05[fg1];
[bg1][fg1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[bf1];
[bf1][wm]overlay=(1920-200):(1080-200)[fv1];
[2:v]gblur=sigma=30:steps=5[bg2];
[2:v]scale=-1:1080,eq=saturation=1.05[fg2];
[bg2][fg2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[bf2];
[bf2][wm]overlay=(1920-200):(1080-200)[fv2];
[3:v]gblur=sigma=30:steps=5[bg3];
[3:v]scale=-1:1080,eq=saturation=1.05[fg3];
[bg3][fg3]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[bf3];
[bf3][wm]overlay=(1920-200):(1080-200)[fv3];
[fv1][1:a][fv2][2:a][fv3][3:a]concat=n=3:v=1:a=1[outv][outa]
The full error message:
[png_pipe @ 0000019fc01f2c00] Invalid stream specifier: wm.
Last message repeated 1 times
Stream specifier 'wm' in filtergraph description [0:v]scale=-1:128[wm];
Upvotes: 0
Views: 166
Reputation: 93018
Intermediate filter outputs can't be reused, like you did by feeding [wm]
to three overlay filters. You can either clone the output to 3 outputs and feed those individually, or in this case, perform the overlay after concat since all overlay parameters are identical.
So, clone method:
[0:v]scale=-1:128,split=3[wm1][wm2][wm3];
...
[bf1][wm1]overlay=(1920-200):(1080-200)[fv1];
...
[bf2][wm2]overlay=(1920-200):(1080-200)[fv2];
....
[bf3][wm3]overlay=(1920-200):(1080-200)[fv3];
or post-concat overlay,
...
[fv1][1:a][fv2][2:a][fv3][3:a]concat=n=3:v=1:a=1[outv][outa];
[outv][wm]overlay=(1920-200):(1080-200)[outv]
(remove the earlier overlays and update pad labels)
Upvotes: 1