[FFmpeg-user] ffmpeg filters

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Fri Nov 15 18:19:25 EET 2019


On 2019-11-15 16:53, David Previs wrote:
>   -y -i "c:\ffmpeg\Black.mp4" -i "C:\pw\temp\watermark99.png" -filter_complex
>   "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2",
>   drawtext="fontsize=24:fontcolor=ffff00 at 0.5:fontfile=/Windows/Fonts/Arial.ttf
>   :text='Huntley Film
>   Archives':x=(w-text_w)/2:y=(h-text_h)-2","drawtext=fontfile='C\:\\WINDOWS\\F
>   onts\\Arial.ttf'\:fontcolor=White\:fontsize=12\:timecode
>   ='00\:00\:00\:00'\:r=25\:x=(w-text_w)/2\:y=(h-text_h)-2" -ac 2 -s 640x480
>   -preset veryfast "c:\ffmpeg\Output.mp4"

David:

I've had my own fights with the ffmpeg filter syntax. You might find it 
helpful to read, very carefully, the syntax documentation at 
<http://ffmpeg.org/ffmpeg-all.html#Filtergraph-description>. It is dense 
and opaque, but turns out to be pretty correct.

It's a little bit harder to figure out your problem, because you are 
still not supplying us the complete, unchanged, uncut command 
invocation. The excerpt above does not include the token "ffmpeg.exe", 
which I'll bet you had at the start of the command line. It includes 
eight newlines, and I'll bet the actual command you entered had only one 
newline. It has a space at the start of every line.

So based on this incomplete invocation, I suggest you eliminate all 
spaces after commas. I imagine ffmpeg reads a filterchain like:

    "overlay=x=…/2", drawtext="fontsize=24:…

And interprets the comma as separating the first filter description and 
from the second, and interprets the second filter description as 
starting with a space. The space is a delimiter, so the filter name, 
between delimiting comma and delimiting space, is a null string.

Note that the filtergraph description in the documentation does not 
mention that it discards insignificant whitespace. Nor does it does not 
do the decent thing and mention that it treats whitespace as 
significant. Opaque.

I would suggest that you eliminate all spaces in your filtergraph, 
except for the literal spaces in the string 'Huntley Film Archives'. I 
also suggest that you enclose the entire filtergraph in a single pair of 
double quotes, instead of putting double quotes around each filter 
description.

My experience is that each non-trivial ffmpeg complex filter will drive 
you mad with its syntax and escaping at least once. Good luck.

Best regards,
       —Jim DeLaHunt, software engineer, Vancouver, Canada

-- 

     --Jim DeLaHunt, jdlh at jdlh.com     http://blog.jdlh.com/ (http://jdlh.com/)
       multilingual websites consultant

       355-1027 Davie St, Vancouver BC V6E 4L2, Canada
          Canada mobile +1-604-376-8953



More information about the ffmpeg-user mailing list