Opened 6 years ago

Closed 5 years ago

#5392 closed defect (fixed)

A bug in the scale2ref filter

Reported by: Mulvya Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


The scale2ref filter allows one to resize an input with reference to a secondary input. However, this can lead to an undesired outcome when the frame aspect ratios of the two inputs are not the same.

Consider the case where a square-pixel 2:1 watermark logo needs to be resized with reference to a square-pixel 4:3 base video. With the scale2ref filter, an expression of scale2ref=-1:ih/2 will lead to the resized watermark having a ratio of 4:3. Not what most users would desire or expect.

A demo command to show the behaviour:

ffmpeg -f lavfi -i "color=black:600x600" -f lavfi -i "color=white:1200x600" -filter_complex "[1][0]scale2ref=-1:ih/2[1v][0v];[0v][1v]overlay[v]" -map "[v]" -t 1 scale2ref-ar-bug.mp4

There should be a way to flag ffmpeg to preserve the operand's aspect ratio with the scale2ref filter.

Change History (2)

comment:1 by Elon Musk, 6 years ago

Component: undeterminedavfilter
Status: newopen
Version: unspecifiedgit-master

comment:2 by Ronald S. Bultje, 5 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.