Why sendcmd
in ffmpeg works with drawtext
, but does not work with scale
, rotation
and other filters?
Example (this code works)
ffmpeg -i testIN.mp4 -filter_complex "[0:v]sendcmd=f=testTXT.cmd,drawtext=fontfile=PF.ttf:text='': fontcolor=white:fontsize=150" testOUT.mp4
testTXT.cmd
0 drawtext reinit 'text=111';
1 drawtext reinit 'text=222';
2 drawtext reinit 'text=333';
Example (this code does not work)
ffmpeg -i testIN.mp4 -filter_complex "[0:v]sendcmd=f=testTXT.cmd,drawbox=x=10:y=10:w=100:h=100" testOUT.mp4
testTXT.cmd
0 drawbox reinit 'x=20:y=20:w=200:h=200';
1 drawbox reinit 'x=30:y=30:w=300:h=300';
2 drawbox reinit 'x=40:y=40:w=400:h=400';
You are encountering several issues:
Not all filters support sendcmd. You can see which filters support sendcmd with
ffmpeg -filters
. Look for a "C
" to the left of the filter name. Additionally, only certain filter options (aka sendcmd "commands") can be used with sendcmd. See the FFmpeg filter documentation, or refer toman ffmpeg-filters
, and view the available options under the Commands section for each filter.Each filter command must be declared in the sendcmd file. The
reinit
shown in the documentation example appears to be limited to the drawtext filter, but this is not explained in the documentation.rotate example
Example sendcmd text file:
Example
ffmpeg
command:The above example will rotate on duration
0
,1
, and2
.overlay example
Example sendcmd text file:
Example
ffmpeg
command: