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 to man 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:
0 rotate angle '45*PI/180';
1 rotate angle '90*PI/180';
2 rotate angle '180*PI/180';
Example ffmpeg
command:
ffmpeg -i input.mp4 -filter_complex "[0:v]sendcmd=f=test.cmd,rotate" output.mp4
The above example will rotate on duration 0
, 1
, and 2
.
overlay example
Example sendcmd text file:
0
overlay@1 x 10,
overlay@1 y 10,
overlay@2 x W-w-10,
overlay@2 y H-h-10,
overlay@3 x (W-w)/2,
overlay@3 y (H-h)/2;
# overlay@1 does not move at this duration so it needs no new entry here
2.25
overlay@2 x 10,
overlay@2 y H-h-10,
overlay@3 x (W-w)/2,
overlay@3 y H-h-10;
Example ffmpeg
command:
ffmpeg -i video.mp4 -i overlay1.png -i overlay2.jpg -i overlay3.png -filter_complex "[0:v]sendcmd=f=test.cmd,nullsink;[0:v][1:v]overlay@1[bg1];[bg1][2:v]overlay@2[bg2];[bg2][3:v]overlay[v]" -map "[v]" -map 0:a? -c:a copy output.mp4
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…