FFMPEG Problem with Filter_Complex with Chain Filters
This script combined three filters into one being drawgrid, drawbox and drawtext. The result had added the text and not added the grid and box.
My script:
Set "BXW=1000" ::Box width
Set "BXH=1008" ::Box height
set "TEXT1=360" :: Text lefthand side (no space characters allowed, see next example)
set "TEXT2=180" :: Text bottom and center
set "TEXT3=0" :: Text righthand side
set "TEXT4=0" :: Text top and center
set "COLOR=red" :: Text color
set "SIZE=200" :: Font size
set "POS_X1=0" ::X1 position of text
set "POS_Y1=(h-th)/2" :: Y1 position of text, use (h-th)/2 for centering
set "POS_X2=(w-tw)/2" :: X2 position of text, use (w-tw)/2 for centering
set "POS_Y2=(h-th)" ::Y2 position of text
set "POS_X3=(w-tw)" ::X3 position of text
set "POS_Y3=(h-th)/2" ::Y3 position of text, use (h-th)/2 for centering
set "POS_X4=(w-tw)/2" :: X4 position of text, use (w-tw)/2 for centering
set "POS_Y4=0" ::Y4 position of text
ffmpeg -i %1 -filter_complex [0:v]"drawgrid=color=red:width=iw/8:height=0:thickness=6,drawgrid=color=blue:width=0:height=ih/12:thickness=6"[grid_s]; [grid_s]"format=rgb24,drawbox=x=((iw/2)-%BXW%/2):y=((ih/2)-%BXH%/2):width=%BXW%:height=%BXH%:thickness=40:color=white"[box_s]; [box_s]drawtext="fontfile="c\:/windows/fonts/arial.ttf":fontcolor=%COLOR%:fontsize=%SIZE%:text=%TEXT1%:x=%POS_X1%:y=%POS_Y1%",drawtext="fontfile="c\:/windows/fonts/arial.ttf":fontcolor=%COLOR%:fontsize=%SIZE%:text=%TEXT2%:x=%POS_X2%:y=%POS_Y2%,drawtext="fontfile="c\:/windows/fonts/arial.ttf":fontcolor=%COLOR%:fontsize=%SIZE%:text=%TEXT3%:x=%POS_X3%:y=%POS_Y3%,drawtext="fontfile="c\:/windows/fonts/arial.ttf":fontcolor=%COLOR%:fontsize=%SIZE%:text=%TEXT4%:x=%POS_X4%:y=%POS_Y4%"[text_s] -frames 1 -y temptxt.png
ffmpeg -i temptxt.png -vf scale=iw/8:-1 -f nut - | ffplay -
Read more here: Source link
