Opened 3 years ago

Closed 2 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

Description

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 Changed 3 years ago by richardpl

  • Component changed from undetermined to avfilter
  • Status changed from new to open
  • Version changed from unspecified to git-master

comment:2 Changed 2 years ago by rbultje

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.