@chapter Syntax@c man begin SYNTAX This section documents the syntax and formats employed by the FFmpeglibraries and tools. @anchor{quoting_and_escaping}@section Quoting and escaping FFmpeg adopts the following quoting and escaping mechanism, unlessexplicitly specified. The following rules are applied: @itemize@item@samp{'} and @samp{\} are special characters (respectively used forquoting and escaping). In addition to them, there might be otherspecial characters depending on the specific syntax where the escapingand quoting are employed. @itemA special character is escaped by prefixing it with a @samp{\}. @itemAll characters enclosed between @samp{''} are included literally in theparsed string. The quote character @samp{'} itself cannot be quoted,so you may need to close the quote and escape it. @itemLeading and trailing whitespaces, unless escaped or quoted, areremoved from the parsed string.@end itemize Note that you may need to add a second level of escaping when usingthe command line or a script, which depends on the syntax of theadopted shell language. The function @code{av_get_token} defined in@file{libavutil/avstring.h} can be used to parse a token quoted orescaped according to the rules defined above. The tool @file{tools/ffescape} in the FFmpeg source tree can be usedto automatically quote or escape a string in a script. @subsection Examples @itemize@itemEscape the string @code{Crime d'Amour} containing the @code{'} specialcharacter:@exampleCrime d\'Amour@end example @itemThe string above contains a quote, so the @code{'} needs to be escapedwhen quoting it:@example'Crime d'\''Amour'@end example @itemInclude leading or trailing whitespaces using quoting:@example' this string starts and ends with whitespaces '@end example @itemEscaping and quoting can be mixed together:@example' The string '\'string\'' is a string '@end example @itemTo include a literal @samp{\} you can use either escaping or quoting:@example'c:\foo' can be written as c:\\foo@end example@end itemize @anchor{date syntax}@section Date The accepted syntax is:@example[(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z]now@end example If the value is "now" it takes the current time. Time is local time unless Z is appended, in which case it isinterpreted as UTC.If the year-month-day part is not specified it takes the currentyear-month-day. @anchor{time duration syntax}@section Time duration There are two accepted syntaxes for expressing time duration. @example[-][@var{HH}:]@var{MM}:@var{SS}[.@var{m}...]@end example @var{HH} expresses the number of hours, @var{MM} the number of minutesfor a maximum of 2 digits, and @var{SS} the number of seconds for amaximum of 2 digits. The @var{m} at the end expresses decimal value for@var{SS}. @emph{or} @example[-]@var{S}+[.@var{m}...]@end example @var{S} expresses the number of seconds, with the optional decimal part@var{m}. In both expressions, the optional @samp{-} indicates negative duration. @subsection Examples The following examples are all valid time duration: @table @samp@item 5555 seconds @item 12:03:4512 hours, 03 minutes and 45 seconds @item 23.18923.189 seconds@end table @anchor{video size syntax}@section Video sizeSpecify the size of the sourced video, it may be a string of the form@var{width}x@var{height}, or the name of a size abbreviation. The following abbreviations are recognized:@table @samp@item ntsc720x480@item pal720x576@item qntsc352x240@item qpal352x288@item sntsc640x480@item spal768x576@item film352x240@item ntsc-film352x240@item sqcif128x96@item qcif176x144@item cif352x288@item 4cif704x576@item 16cif1408x1152@item qqvga160x120@item qvga320x240@item vga640x480@item svga800x600@item xga1024x768@item uxga1600x1200@item qxga2048x1536@item sxga1280x1024@item qsxga2560x2048@item hsxga5120x4096@item wvga852x480@item wxga1366x768@item wsxga1600x1024@item wuxga1920x1200@item woxga2560x1600@item wqsxga3200x2048@item wquxga3840x2400@item whsxga6400x4096@item whuxga7680x4800@item cga320x200@item ega640x350@item hd480852x480@item hd7201280x720@item hd10801920x1080@item 2k2048x1080@item 2kflat1998x1080@item 2kscope2048x858@item 4k4096x2160@item 4kflat3996x2160@item 4kscope4096x1716@item nhd640x360@item hqvga240x160@item wqvga400x240@item fwqvga432x240@item hvga480x320@item qhd960x540@item 2kdci2048x1080@item 4kdci4096x2160@item uhd21603840x2160@item uhd43207680x4320@end table @anchor{video rate syntax}@section Video rate Specify the frame rate of a video, expressed as the number of framesgenerated per second. It has to be a string in the format@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floatnumber or a valid video frame rate abbreviation. The following abbreviations are recognized:@table @samp@item ntsc30000/1001@item pal25/1@item qntsc30000/1001@item qpal25/1@item sntsc30000/1001@item spal25/1@item film24/1@item ntsc-film24000/1001@end table @anchor{ratio syntax}@section Ratio A ratio can be expressed as an expression, or in the form@var{numerator}:@var{denominator}. Note that a ratio with infinite (1/0) or negative value isconsidered valid, so you should check on the returned value if youwant to exclude those values. The undefined value can be expressed using the "0:0" string. @anchor{color syntax}@section Color It can be the name of a color as defined below (case insensitive match) or a@code{[0x|#]RRGGBB[AA]} sequence, possibly followed by @@ and a stringrepresenting the alpha component. The alpha component may be a string composed by "0x" followed by anhexadecimal number or a decimal number between 0.0 and 1.0, whichrepresents the opacity value (@samp{0x00} or @samp{0.0} means completelytransparent, @samp{0xff} or @samp{1.0} completely opaque). If the alphacomponent is not specified then @samp{0xff} is assumed. The string @samp{random} will result in a random color. The following names of colors are recognized:@table @samp@item AliceBlue0xF0F8FF@item AntiqueWhite0xFAEBD7@item Aqua0x00FFFF@item Aquamarine0x7FFFD4@item Azure0xF0FFFF@item Beige0xF5F5DC@item Bisque0xFFE4C4@item Black0x000000@item BlanchedAlmond0xFFEBCD@item Blue0x0000FF@item BlueViolet0x8A2BE2@item Brown0xA52A2A@item BurlyWood0xDEB887@item CadetBlue0x5F9EA0@item Chartreuse0x7FFF00@item Chocolate0xD2691E@item Coral0xFF7F50@item CornflowerBlue0x6495ED@item Cornsilk0xFFF8DC@item Crimson0xDC143C@item Cyan0x00FFFF@item DarkBlue0x00008B@item DarkCyan0x008B8B@item DarkGoldenRod0xB8860B@item DarkGray0xA9A9A9@item DarkGreen0x006400@item DarkKhaki0xBDB76B@item DarkMagenta0x8B008B@item DarkOliveGreen0x556B2F@item Darkorange0xFF8C00@item DarkOrchid0x9932CC@item DarkRed0x8B0000@item DarkSalmon0xE9967A@item DarkSeaGreen0x8FBC8F@item DarkSlateBlue0x483D8B@item DarkSlateGray0x2F4F4F@item DarkTurquoise0x00CED1@item DarkViolet0x9400D3@item DeepPink0xFF1493@item DeepSkyBlue0x00BFFF@item DimGray0x696969@item DodgerBlue0x1E90FF@item FireBrick0xB22222@item FloralWhite0xFFFAF0@item ForestGreen0x228B22@item Fuchsia0xFF00FF@item Gainsboro0xDCDCDC@item GhostWhite0xF8F8FF@item Gold0xFFD700@item GoldenRod0xDAA520@item Gray0x808080@item Green0x008000@item GreenYellow0xADFF2F@item HoneyDew0xF0FFF0@item HotPink0xFF69B4@item IndianRed0xCD5C5C@item Indigo0x4B0082@item Ivory0xFFFFF0@item Khaki0xF0E68C@item Lavender0xE6E6FA@item LavenderBlush0xFFF0F5@item LawnGreen0x7CFC00@item LemonChiffon0xFFFACD@item LightBlue0xADD8E6@item LightCoral0xF08080@item LightCyan0xE0FFFF@item LightGoldenRodYellow0xFAFAD2@item LightGreen0x90EE90@item LightGrey0xD3D3D3@item LightPink0xFFB6C1@item LightSalmon0xFFA07A@item LightSeaGreen0x20B2AA@item LightSkyBlue0x87CEFA@item LightSlateGray0x778899@item LightSteelBlue0xB0C4DE@item LightYellow0xFFFFE0@item Lime0x00FF00@item LimeGreen0x32CD32@item Linen0xFAF0E6@item Magenta0xFF00FF@item Maroon0x800000@item MediumAquaMarine0x66CDAA@item MediumBlue0x0000CD@item MediumOrchid0xBA55D3@item MediumPurple0x9370D8@item MediumSeaGreen0x3CB371@item MediumSlateBlue0x7B68EE@item MediumSpringGreen0x00FA9A@item MediumTurquoise0x48D1CC@item MediumVioletRed0xC71585@item MidnightBlue0x191970@item MintCream0xF5FFFA@item MistyRose0xFFE4E1@item Moccasin0xFFE4B5@item NavajoWhite0xFFDEAD@item Navy0x000080@item OldLaceLines 1–500 of 1089. Load more
@chapter Syntax @c man begin SYNTAX This section documents the syntax and formats employed by the FFmpeg libraries and tools. @anchor{quoting_and_escaping} @section Quoting and escaping FFmpeg adopts the following quoting and escaping mechanism, unless explicitly specified. The following rules are applied: @itemize @item @samp{'} and @samp{\} are special characters (respectively used for quoting and escaping). In addition to them, there might be other special characters depending on the specific syntax where the escaping and quoting are employed. @item A special character is escaped by prefixing it with a @samp{\}. @item All characters enclosed between @samp{''} are included literally in the parsed string. The quote character @samp{'} itself cannot be quoted, so you may need to close the quote and escape it. @item Leading and trailing whitespaces, unless escaped or quoted, are removed from the parsed string. @end itemize Note that you may need to add a second level of escaping when using the command line or a script, which depends on the syntax of the adopted shell language. The function @code{av_get_token} defined in @file{libavutil/avstring.h} can be used to parse a token quoted or escaped according to the rules defined above. The tool @file{tools/ffescape} in the FFmpeg source tree can be used to automatically quote or escape a string in a script. @subsection Examples @itemize @item Escape the string @code{Crime d'Amour} containing the @code{'} special character: @example Crime d\'Amour @end example @item The string above contains a quote, so the @code{'} needs to be escaped when quoting it: @example 'Crime d'\''Amour' @end example @item Include leading or trailing whitespaces using quoting: @example ' this string starts and ends with whitespaces ' @end example @item Escaping and quoting can be mixed together: @example ' The string '\'string\'' is a string ' @end example @item To include a literal @samp{\} you can use either escaping or quoting: @example 'c:\foo' can be written as c:\\foo @end example @end itemize @anchor{date syntax} @section Date The accepted syntax is: @example [(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z] now @end example If the value is "now" it takes the current time. Time is local time unless Z is appended, in which case it is interpreted as UTC. If the year-month-day part is not specified it takes the current year-month-day. @anchor{time duration syntax} @section Time duration There are two accepted syntaxes for expressing time duration. @example [-][@var{HH}:]@var{MM}:@var{SS}[.@var{m}...] @end example @var{HH} expresses the number of hours, @var{MM} the number of minutes for a maximum of 2 digits, and @var{SS} the number of seconds for a maximum of 2 digits. The @var{m} at the end expresses decimal value for @var{SS}. @emph{or} @example [-]@var{S}+[.@var{m}...] @end example @var{S} expresses the number of seconds, with the optional decimal part @var{m}. In both expressions, the optional @samp{-} indicates negative duration. @subsection Examples The following examples are all valid time duration: @table @samp @item 55 55 seconds @item 12:03:45 12 hours, 03 minutes and 45 seconds @item 23.189 23.189 seconds @end table @anchor{video size syntax} @section Video size Specify the size of the sourced video, it may be a string of the form @var{width}x@var{height}, or the name of a size abbreviation. The following abbreviations are recognized: @table @samp @item ntsc 720x480 @item pal 720x576 @item qntsc 352x240 @item qpal 352x288 @item sntsc 640x480 @item spal 768x576 @item film 352x240 @item ntsc-film 352x240 @item sqcif 128x96 @item qcif 176x144 @item cif 352x288 @item 4cif 704x576 @item 16cif 1408x1152 @item qqvga 160x120 @item qvga 320x240 @item vga 640x480 @item svga 800x600 @item xga 1024x768 @item uxga 1600x1200 @item qxga 2048x1536 @item sxga 1280x1024 @item qsxga 2560x2048 @item hsxga 5120x4096 @item wvga 852x480 @item wxga 1366x768 @item wsxga 1600x1024 @item wuxga 1920x1200 @item woxga 2560x1600 @item wqsxga 3200x2048 @item wquxga 3840x2400 @item whsxga 6400x4096 @item whuxga 7680x4800 @item cga 320x200 @item ega 640x350 @item hd480 852x480 @item hd720 1280x720 @item hd1080 1920x1080 @item 2k 2048x1080 @item 2kflat 1998x1080 @item 2kscope 2048x858 @item 4k 4096x2160 @item 4kflat 3996x2160 @item 4kscope 4096x1716 @item nhd 640x360 @item hqvga 240x160 @item wqvga 400x240 @item fwqvga 432x240 @item hvga 480x320 @item qhd 960x540 @item 2kdci 2048x1080 @item 4kdci 4096x2160 @item uhd2160 3840x2160 @item uhd4320 7680x4320 @end table @anchor{video rate syntax} @section Video rate Specify the frame rate of a video, expressed as the number of frames generated per second. It has to be a string in the format @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float number or a valid video frame rate abbreviation. The following abbreviations are recognized: @table @samp @item ntsc 30000/1001 @item pal 25/1 @item qntsc 30000/1001 @item qpal 25/1 @item sntsc 30000/1001 @item spal 25/1 @item film 24/1 @item ntsc-film 24000/1001 @end table @anchor{ratio syntax} @section Ratio A ratio can be expressed as an expression, or in the form @var{numerator}:@var{denominator}. Note that a ratio with infinite (1/0) or negative value is considered valid, so you should check on the returned value if you want to exclude those values. The undefined value can be expressed using the "0:0" string. @anchor{color syntax} @section Color It can be the name of a color as defined below (case insensitive match) or a @code{[0x|#]RRGGBB[AA]} sequence, possibly followed by @@ and a string representing the alpha component. The alpha component may be a string composed by "0x" followed by an hexadecimal number or a decimal number between 0.0 and 1.0, which represents the opacity value (@samp{0x00} or @samp{0.0} means completely transparent, @samp{0xff} or @samp{1.0} completely opaque). If the alpha component is not specified then @samp{0xff} is assumed. The string @samp{random} will result in a random color. The following names of colors are recognized: @table @samp @item AliceBlue 0xF0F8FF @item AntiqueWhite 0xFAEBD7 @item Aqua 0x00FFFF @item Aquamarine 0x7FFFD4 @item Azure 0xF0FFFF @item Beige 0xF5F5DC @item Bisque 0xFFE4C4 @item Black 0x000000 @item BlanchedAlmond 0xFFEBCD @item Blue 0x0000FF @item BlueViolet 0x8A2BE2 @item Brown 0xA52A2A @item BurlyWood 0xDEB887 @item CadetBlue 0x5F9EA0 @item Chartreuse 0x7FFF00 @item Chocolate 0xD2691E @item Coral 0xFF7F50 @item CornflowerBlue 0x6495ED @item Cornsilk 0xFFF8DC @item Crimson 0xDC143C @item Cyan 0x00FFFF @item DarkBlue 0x00008B @item DarkCyan 0x008B8B @item DarkGoldenRod 0xB8860B @item DarkGray 0xA9A9A9 @item DarkGreen 0x006400 @item DarkKhaki 0xBDB76B @item DarkMagenta 0x8B008B @item DarkOliveGreen 0x556B2F @item Darkorange 0xFF8C00 @item DarkOrchid 0x9932CC @item DarkRed 0x8B0000 @item DarkSalmon 0xE9967A @item DarkSeaGreen 0x8FBC8F @item DarkSlateBlue 0x483D8B @item DarkSlateGray 0x2F4F4F @item DarkTurquoise 0x00CED1 @item DarkViolet 0x9400D3 @item DeepPink 0xFF1493 @item DeepSkyBlue 0x00BFFF @item DimGray 0x696969 @item DodgerBlue 0x1E90FF @item FireBrick 0xB22222 @item FloralWhite 0xFFFAF0 @item ForestGreen 0x228B22 @item Fuchsia 0xFF00FF @item Gainsboro 0xDCDCDC @item GhostWhite 0xF8F8FF @item Gold 0xFFD700 @item GoldenRod 0xDAA520 @item Gray 0x808080 @item Green 0x008000 @item GreenYellow 0xADFF2F @item HoneyDew 0xF0FFF0 @item HotPink 0xFF69B4 @item IndianRed 0xCD5C5C @item Indigo 0x4B0082 @item Ivory 0xFFFFF0 @item Khaki 0xF0E68C @item Lavender 0xE6E6FA @item LavenderBlush 0xFFF0F5 @item LawnGreen 0x7CFC00 @item LemonChiffon 0xFFFACD @item LightBlue 0xADD8E6 @item LightCoral 0xF08080 @item LightCyan 0xE0FFFF @item LightGoldenRodYellow 0xFAFAD2 @item LightGreen 0x90EE90 @item LightGrey 0xD3D3D3 @item LightPink 0xFFB6C1 @item LightSalmon 0xFFA07A @item LightSeaGreen 0x20B2AA @item LightSkyBlue 0x87CEFA @item LightSlateGray 0x778899 @item LightSteelBlue 0xB0C4DE @item LightYellow 0xFFFFE0 @item Lime 0x00FF00 @item LimeGreen 0x32CD32 @item Linen 0xFAF0E6 @item Magenta 0xFF00FF @item Maroon 0x800000 @item MediumAquaMarine 0x66CDAA @item MediumBlue 0x0000CD @item MediumOrchid 0xBA55D3 @item MediumPurple 0x9370D8 @item MediumSeaGreen 0x3CB371 @item MediumSlateBlue 0x7B68EE @item MediumSpringGreen 0x00FA9A @item MediumTurquoise 0x48D1CC @item MediumVioletRed 0xC71585 @item MidnightBlue 0x191970 @item MintCream 0xF5FFFA @item MistyRose 0xFFE4E1 @item Moccasin 0xFFE4B5 @item NavajoWhite 0xFFDEAD @item Navy 0x000080 @item OldLace