1

So I want to create videos that had a red overlay, effect and I assume that blend is the right options filter for this. Here my command :

ffmpeg -i dogs.mp4 -i red.jpg -filter_complex '[1:v]scale=1280:720[ckout];[0:v][ckout]blend=all_mode='multiply'[out]' -map '[out]' output.mp4

But when i tried this I always got :

Press [q] to stop, [?] for help
[swscaler @ 00000263f19a9560] deprecated pixel format used, make sure you did set range correctly
[Parsed_blend_1 @ 00000263f192fa20] First input link top parameters (size 1920x1080, SAR 0:1) do not match the corresponding second input link bottom parameters (1280x720, SAR 1:1)
[Parsed_blend_1 @ 00000263f192fa20] Failed to configure output pad on Parsed_blend_1
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

What is the right command for this?

  • Do you want to add a red tint on top? – Gyan May 13 at 11:01
  • @Gyan Yes, I'm blending red tint png actually and, overlay it on top of video with multiply rule – mandaputtra May 13 at 15:47
  • As Gyan's answer indicates, any filter involving two or more videos being put together in any way, requires that those videos have the same resolutions. Exceptions would be filters like the vstack where only one line of the resolutions need to match. Scale red.jpg before starting the blend. Several ways to do this, Gyan's solution being pretty handy. – DigiVision Media May 13 at 16:16
3

The blend filter requires both inputs to have the same resolution. You can use the scale2ref filter to resize the overlay.

ffmpeg -i dogs.mp4 -i red.jpg -filter_complex '[1:v][0:v]scale2ref[ckout][vid];[vid][ckout]blend=all_mode='multiply'[out]' -map '[out]' output.mp4

  • scale2ref That's a handy filter. So it scales the res of the first input [1:v] to match the second [0:v]? – DigiVision Media May 13 at 16:18
  • 2
    Yes, it just gives access to the attributes of a reference video. The target size does not have to be the same as the reference. That's the behaviour of the default values. See ffmpeg.org/ffmpeg-filters.html#scale2ref – Gyan May 13 at 16:20
  • Hmm, interesting, the scale works but the error still happens First input link top parameters (size 1920x1080, SAR 0:1) do not match the corresponding second input link bottom parameters (1920x1080, SAR 1:1) Failed to configure output pad on Parsed_blend_1 I'm using 3.4. – mandaputtra May 14 at 2:59
  • I got it working with this. ffmpeg -i red.jpg -i dogs.mp4 -filter_complex "[0][1]scale2ref[a][b];[a]setdar=16/9[c];[b]setdar=16/9[d];[c][d]blend=all_mode=overlay:all_opacity=1[out]" -map "[out]" output6.mp4 actually your command should be right. can't edit my comment because of StackOverflow so I add a new one – mandaputtra May 14 at 4:41
  • 2
    Recent versions of ffmpeg blend filter no longer require matching aspect ratios. – Gyan May 14 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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