Scale (resize) the input video, based on a reference video.
See the scale filter for available options, scale2ref supports the same but uses the reference video instead of the main input as basis. scale2ref also supports the following additional constants for the w and h options:
- main_w, main_h
-
The main input video’s width and height
- main_a
-
The same as main_w / main_h
- main_sar
-
The main input video’s sample aspect ratio
- main_dar, mdar
-
The main input video’s display aspect ratio. Calculated from
(main_w / main_h) * main_sar
. - main_hsub, main_vsub
-
The main input video’s horizontal and vertical chroma subsample values. For example for the pixel format "yuv422p" hsub is 2 and vsub is 1.
Examples
-
Scale a subtitle stream (b) to match the main video (a) in size before overlaying
'scale2ref[b][a];[a][b]overlay'
-
Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
[logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]