FFmpeg Utilities Documentation

1 Description

This document describes some generic features and utilities provided by the libavutil library.

2 Syntax

This section documents the syntax and formats employed by the FFmpeg libraries and tools.

2.1 Quoting and escaping

FFmpeg adopts the following quoting and escaping mechanism, unless explicitly specified. The following rules are applied:

  • ‘'’ and ‘\’ 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.
  • A special character is escaped by prefixing it with a ‘\’.
  • All characters enclosed between ‘''’ are included literally in the parsed string. The quote character ‘'’ itself cannot be quoted, so you may need to close the quote and escape it.
  • Leading and trailing whitespaces, unless escaped or quoted, are removed from the parsed string.

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 av_get_token defined in libavutil/avstring.h can be used to parse a token quoted or escaped according to the rules defined above.

The tool tools/ffescape in the FFmpeg source tree can be used to automatically quote or escape a string in a script.

2.1.1 Examples

  • Escape the string Crime d'Amour containing the ' special character:
    Crime d\'Amour
    
  • The string above contains a quote, so the ' needs to be escaped when quoting it:
    'Crime d'\''Amour'
    
  • Include leading or trailing whitespaces using quoting:
    '  this string starts and ends with whitespaces  '
    
  • Escaping and quoting can be mixed together:
    ' The string '\'string\'' is a string '
    
  • To include a literal ‘\’ you can use either escaping or quoting:
    'c:\foo' can be written as c:\\foo
    

2.2 Date

The accepted syntax is:

[(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z]
now

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.

2.3 Time duration

There are two accepted syntaxes for expressing time duration.

[-][HH:]MM:SS[.m...]

HH expresses the number of hours, MM the number of minutes for a maximum of 2 digits, and SS the number of seconds for a maximum of 2 digits. The m at the end expresses decimal value for SS.

or

[-]S+[.m...][s|ms|us]

S expresses the number of seconds, with the optional decimal part m. The optional literal suffixes ‘s’, ‘ms’ or ‘us’ indicate to interpret the value as seconds, milliseconds or microseconds, respectively.

In both expressions, the optional ‘-’ indicates negative duration.

2.3.1 Examples

The following examples are all valid time duration:

‘55’

55 seconds

‘0.2’

0.2 seconds

‘200ms’

200 milliseconds, that’s 0.2s

‘200000us’

200000 microseconds, that’s 0.2s

‘12:03:45’

12 hours, 03 minutes and 45 seconds

‘23.189’

23.189 seconds

2.4 Video size

Specify the size of the sourced video, it may be a string of the form widthxheight, or the name of a size abbreviation.

The following abbreviations are recognized:

‘ntsc’

720x480

‘pal’

720x576

‘qntsc’

352x240

‘qpal’

352x288

‘sntsc’

640x480

‘spal’

768x576

‘film’

352x240

‘ntsc-film’

352x240

‘sqcif’

128x96

‘qcif’

176x144

‘cif’

352x288

‘4cif’

704x576

‘16cif’

1408x1152

‘qqvga’

160x120

‘qvga’

320x240

‘vga’

640x480

‘svga’

800x600

‘xga’

1024x768

‘uxga’

1600x1200

‘qxga’

2048x1536

‘sxga’

1280x1024

‘qsxga’

2560x2048

‘hsxga’

5120x4096

‘wvga’

852x480

‘wxga’

1366x768

‘wsxga’

1600x1024

‘wuxga’

1920x1200

‘woxga’

2560x1600

‘wqsxga’

3200x2048

‘wquxga’

3840x2400

‘whsxga’

6400x4096

‘whuxga’

7680x4800

‘cga’

320x200

‘ega’

640x350

‘hd480’

852x480

‘hd720’

1280x720

‘hd1080’

1920x1080

‘2k’

2048x1080

‘2kflat’

1998x1080

‘2kscope’

2048x858

‘4k’

4096x2160

‘4kflat’

3996x2160

‘4kscope’

4096x1716

‘nhd’

640x360

‘hqvga’

240x160

‘wqvga’

400x240

‘fwqvga’

432x240

‘hvga’

480x320

‘qhd’

960x540

‘2kdci’

2048x1080

‘4kdci’

4096x2160

‘u