FFmpeg 6.0.1
Since* 0.9
#

Create a pattern generated by an elementary cellular automaton.

The initial state of the cellular automaton can be defined through the filename and pattern options. If such options are not specified an initial state is created randomly.

At each new frame a new row in the video is filled with the result of the cellular automaton next generation. The behavior when the whole frame is filled is defined by the scroll option.

This source accepts the following options:

filename, f

Read the initial cellular automaton state, i.e. the starting row, from the specified file. In the file, each non-whitespace character is considered an alive cell, a newline will terminate the row, and further characters in the file will be ignored.

pattern, p

Read the initial cellular automaton state, i.e. the starting row, from the specified string.

Each non-whitespace character in the string is considered an alive cell, a newline will terminate the row, and further characters in the string will be ignored.

rate, r

Set the video rate, that is the number of frames generated per second. Default is 25.

random_fill_ratio, ratio

Set the random fill ratio for the initial cellular automaton row. It is a floating point number value ranging from 0 to 1, defaults to 1/PHI.

This option is ignored when a file or a pattern is specified.

random_seed, seed

Set the seed for filling randomly the initial row, must be an integer included between 0 and UINT32_MAX. If not specified, or if explicitly set to -1, the filter will try to use a good random seed on a best effort basis.

rule

Set the cellular automaton rule, it is a number ranging from 0 to 255. Default value is 110.

size, s

Set the size of the output video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual.

If filename or pattern is specified, the size is set by default to the width of the specified initial state row, and the height is set to width * PHI.

If size is set, it must contain the width of the specified pattern string, and the specified pattern will be centered in the larger row.

If a filename or a pattern string is not specified, the size value defaults to "320x518" (used for a randomly generated initial state).

scroll

If set to 1, scroll the output upward when all the rows in the output have been already filled. If set to 0, the new generated row will be written over the top row just after the bottom row is filled. Defaults to 1.

start_full, full

If set to 1, completely fill the output with generated rows before outputting the first frame. This is the default behavior, for disabling set the value to 0.

stitch

If set to 1, stitch the left and right row edges together. This is the default behavior, for disabling set the value to 0.

#

Examples

  • Read the initial state from pattern, and specify an output of size 200x400.

    cellauto=f=pattern:s=200x400
  • Generate a random initial row with a width of 200 cells, with a fill ratio of 2/3:

    cellauto=ratio=2/3:s=200x200
  • Create a pattern generated by rule 18 starting by a single alive cell centered on an initial row with width 100:

    cellauto=p=@:s=100x400:full=0:rule=18
  • Specify a more elaborated initial pattern:

    cellauto=p='@@ @ @@':s=100x400:full=0:rule=18