[FFmpeg-user] sendcmd and drawtext - using more than one in the same filtergraph?

Paul B Mahol onemda at gmail.com
Fri Apr 28 18:28:42 EEST 2017


On 4/28/17, Mark Burton <mwjburton at gmail.com> wrote:
> Using a single sendcmd to read text from an external file and command a
> single drawtext, is working fine:
>
> ffmpeg -i input.mov -c:v dnxhd -b:v 115M -pix_fmt yuv422p -vf
> "sendcmd=filename=commandFile1,drawtext=fontfile=/System/Library/Fonts/Helvetica.dfont:fontsize=20:fontcolor=white:x=10:y=30:text="
> -an output.mov
>
> However I need to have two or more drawtext filters being commanded from
> separate sendcmd files in the same filtergraph.
>
> I believe I need to assign filter instance names to each drawtext command
> and then reference that name for [TARGET] in the sendcmd text file, but
> after reading through the docs and trying a few ideas, I'm no closer.
>
> The basic command (currently not working):
>
> ffmpeg -i input.mov -c:v dnxhd -b:v 115M -pix_fmt yuv422p -vf
> "sendcmd=filename=commandFile1,drawtext=fontfile=/System/Library/Fonts/Helvetica.dfont:fontsize=20:fontcolor=white:x=10:y=30:text=,sendcmd=filename=commandFile2,drawtext=fontfile=/System/Library/Fonts/Helvetica.dfont:fontsize=20:fontcolor=red:x=10:y=60:text="
> -an output.mov
>
> Result:
> drawtext 1 - after 1 frame at each new text entry, text from commandFile2 is
> overriding text from commandFile1.
> drawtext 2 - nothing is being drawn by this filter.
>
> ...contents of the sendcmd files:
>
> commandFile1
> 00:00:00.000-00:00:01.000 [enter] drawtext reinit 'text=Note A';
> 00:00:01.000-00:00:01.958 [enter] drawtext reinit 'text=Note B';
>
> commandFile2
> 00:00:00.000-00:00:01.000 [enter] drawtext reinit 'text=Tag 1';
> 00:00:01.000-00:00:01.958 [enter] drawtext reinit 'text=Tag 2';
>

You need to use Parsed_drawtext_X instead of drawtext, replace X with
number of filter in filtergraph.

So if its 3rd filter in filtergraph its number will be 2. Because
lavfi counts from 0.


More information about the ffmpeg-user mailing list