[FFmpeg-user] the mix filter -- Help, please

Mark Filipak (ffmpeg) markfilipak at bog.us
Sat Apr 3 13:40:38 EEST 2021


As shown below, the mix filter appears to be failing and I don't know why. Can you help, please?

ffmpeg -i SOURCE -vf "showinfo,split=2[1][2],[1][2]mix=inputs=2:weights=5 5,showinfo" ...

The 'showinfo' information includes:
[Parsed_showinfo_0 ...] n:   0 pts:      0 pts_time:0       pos:     5804 fmt:yuv420p ...
[Parsed_showinfo_0 ...] color_range:tv color_space:bt709 color_primaries:bt709 color_trc:bt709
[Parsed_showinfo_3 ...] n:   0 pts:      0 pts_time:0       pos:       -1 fmt:yuv420p ...
[Parsed_showinfo_3 ...] color_range:unknown color_space:unknown color_primaries:unknown 
color_trc:unknown

What does "pos" mean?
What does "pos:       -1" indicate?
Does "unknown" mean that 'mix' can't handle bt709?
Is there a fix?
Is there a weighted pixel mixing alternative to 'mix'?

I've rewritten the 'mix' documentation (below). Any input/criticism/opinion/correction is welcome.

Thanks!
Mark.


mix   ...Combine 2 or more streams, pixel-by-pixel, via weighted, scaled, pixel mixing.
Changes TB: No.
Changes PTS: No.
Changes frames: No.
Changes fields: No.
Changes pixels: Yes.
Method: Weighted, scaled, pixel mixing [note 1].

mix=inputs=2:duration=longest:weights=[note 2]:scale=[note 3]   ...Defaults.
            :          :
            :          first      ...End the output at the end of the first input.
            :          shortest   ...End the output at the end of the shortest input.
            :          longest    ...End the output at the end of the longest input.
            The number of inputs.

[note 1] Weighted, scaled, pixel mixing method:
          for each input (1, 2, etc.),
            for each frame,
              for each pixel (p1, p2, etc.),
                (p1)x(weight1)x(scale1) --------.
                (p2)x(weight2)x(scale2) ---.    ¦
                  :                        ¦    ¦
                 etc.                     (+)--(+)--> output pixel

[note 1] There can be 1 scale per input, or, if missing, a per-input scale is applied,
e.g. scale1 = weight1/(sum of all weights), scale2 = weight2/(sum of all weights), etc.
{was: "Specify scale, if it is set it will be multiplied with sum of each weight multiplied with 
pixel values to give final destination pixel value. By default scale is auto scaled to sum of weights."}

[note 2] There can be 1 weight per input (as a list of numbers separated by spaces), or 1 weight for 
all inputs, or a partial list. If there are more inputs than weights, the last weight in the list is 
assigned to the remaining inputs.
{was: "Specify weight of each input video stream as sequence. Each weight is separated by space. If 
number of weights is smaller than number of frames last specified weight will be used for all 
remaining unset weights."}


More information about the ffmpeg-user mailing list