user26966: I have an ffmpeg command using -vf to deinterlace videos and produce pixel format with 4:2:0 chroma subsampling:
ffmpeg -i input.mp4 -vf yadif,format=yuv420p \ 
-force_key_frames expr:gte(t\,n_forced/2) \
-c:v libx264 -crf 23 output.mp4

Also I have another ffmpeg command to put on my watermark:
ffmpeg -i input.mp4 -i logo.png \
-filter_complex "[1][0]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)'" \
-c:v libx264 -crf 23 output.mp4

I tried to put them together and got this error:
-vf/-af/-filter and -filter_complex cannot be used together for the same stream

I read that -filter_complex can be used for simple filters, and we can chain the filters together, separated by commas, so I created a new command without -vf:
ffmpeg -i input.mp4 -i logo.png \
filter_complex "[1][0]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)',yadif,format=yuv420p" -force_key_frames expr:gte(t\,n_forced/2) -c:v libx264 -crf 23 output.mp4

Is this the right way to combine these two filters?
The console doesn't show the above error but a new error:
Missing ')' or too many args in 'gte(t\,n_forced/2)'
Invalid force_key_frames expression 'gte(t\,n_forced/2)'
Error initializing output stream 0:0 --
[aac @ 0000022fbe6eacc0] Qavg: 118.000
[aac @ 0000022fbe6eacc0] 2 frames left in the queue on closing
Conversion failed!

Please help!

user1871: Use
ffmpeg -i input.mp4 -i logo.png \
-filter_complex "[0]yadif,format=yuv420p[main];[1][main]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)'" \
-force_key_frames "expr:gte(t,n_forced/2)" -c:v libx264 -crf 23 -c:a copy output.mp4


26966: <p>I have an ffmpeg command using -vf to deinterlace videos and produce pixel format with 4:2:0 chroma subsampling:</p>

<pre><code>ffmpeg -i input.mp4 -vf yadif,format=yuv420p \ 
-force_key_frames expr:gte(t\,n_forced/2) \
-c:v libx264 -crf 23 output.mp4
</code></pre>

<p>Also I have another ffmpeg command to put on my watermark:</p>

<pre><code>ffmpeg -i input.mp4 -i logo.png \
-filter_complex "[1][0]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)'" \
-c:v libx264 -crf 23 output.mp4
</code></pre>

<p>I tried to put them together and got this error:</p>

<pre><code>-vf/-af/-filter and -filter_complex cannot be used together for the same stream
</code></pre>

<p>I read that -filter_complex can be used for simple filters, and we can chain the filters together, separated by commas, so I created a new command without -vf:</p>

<pre><code>ffmpeg -i input.mp4 -i logo.png \
filter_complex "[1][0]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)',yadif,format=yuv420p" -force_key_frames expr:gte(t\,n_forced/2) -c:v libx264 -crf 23 output.mp4
</code></pre>

<p>Is this the right way to combine these two filters?</p>

<p>The console doesn't show the above error but a new error:</p>

<pre><code>Missing ')' or too many args in 'gte(t\,n_forced/2)'
Invalid force_key_frames expression 'gte(t\,n_forced/2)'
Error initializing output stream 0:0 --
[aac @ 0000022fbe6eacc0] Qavg: 118.000
[aac @ 0000022fbe6eacc0] 2 frames left in the queue on closing
Conversion failed!
</code></pre>

<p>Please help!</p>
 1871: <p>Use</p>

<pre><code>ffmpeg -i input.mp4 -i logo.png \
-filter_complex "[0]yadif,format=yuv420p[main];[1][main]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)'" \
-force_key_frames "expr:gte(t,n_forced/2)" -c:v libx264 -crf 23 -c:a copy output.mp4
</code></pre>
