Opened 4 weeks ago

Closed 3 days ago

#10973 closed defect (fixed)

scale2ref truncates the referent stream

Reported by: boris-petrov Owned by:
Priority: important Component: undetermined
Version: git-master Keywords:
Cc: boris-petrov Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

This filter:

-vf 'scale=min(640\,iw):trunc(ow/a/2)*2,format=rgba[vid1];movie=image.png[img1];[img1][vid1]scale2ref[img][vid];[vid][img]overlay=x=0:y=0,format=rgba'

Used to work for all frames but in FFmpeg version 7 produces a video of one frame. Using:

-vf 'scale=min(640\,iw):trunc(ow/a/2)*2,format=rgba[vid1];movie=image.png[img1];[img1]scale=w=640:h=-1[img];[vid1][img]overlay=x=0:y=0,format=rgba'

Works as intended.

ffmpeg version 7.0.git Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-4ubuntu3)
  configuration: --extra-libs='-lm -lpthread' --prefix=/home/next/ffmpeg_build --pkg-config-flags=--static --extra-cflags='-I/home/next/ffmpeg_build/include -I/opt/cuda/include/' --extra-ldflags='-L/home/next/ffmpeg_build/lib -L/opt/cuda/lib64/' --bindir=/home/next/bin --disable-debug --enable-cuda --enable-cuda-nvcc --enable-cuvid --enable-ffnvcodec --enable-fontconfig --enable-gmp --enable-gpl --enable-libaom --enable-libass --enable-libdav1d --enable-libfdk-aac --enable-libflite --enable-libfreetype --enable-libgsm --enable-libharfbuzz --enable-libfontconfig --enable-libfribidi --enable-libmp3lame --enable-libnpp --enable-libopenjpeg --enable-libopus --enable-librav1e --enable-libsmbclient --enable-libsrt --enable-libssh --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lto --enable-nonfree --enable-nvdec --enable-nvenc --enable-omx --enable-opencl --enable-openssl --enable-pic --enable-version3 --enable-vulkan
  libavutil      59. 13.100 / 59. 13.100
  libavcodec     61.  5.101 / 61.  5.101
  libavformat    61.  3.100 / 61.  3.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.101 / 10.  2.101
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100

FFmpeg commit the build is from is 7b7b7819bd21cc92ac07f6696b0e7f26fa8f9834.

Change History (2)

comment:1 by maruno, 3 days ago

I came across this issue as well after upgrading to ffmpeg 7.0.

What I noticed as well researching the issue is that the scale2ref was not as-is in the documentation anymore. It seems it's being integrated into the normal scale filter and the documentation was already reflected to this situation.

It doesn't work in the 7.0-release version, bug I installed the latest HEAD (8670615743eb36d7b3e9b522266518796df7ec54) version and changed my parameters to reflect the new scale filter syntax that performs the reference:

From: [1:v][scaled_v]scale2ref=w=oh*mdar:h=ih/1.25[scaled_wm][scaled_v]

To: [scaled_v]split[ref][scaled_v];[1:v][ref]scale=w=oh*dar:h=rh/1.25[scaled_wm]

The new syntax is a bit weird with the required split in front, but it worked! (I suspect the documentation or implementation might not be final) The bug doesn't occur with this HEAD-build and the new scale-filter syntax with reference. Perhaps this helps you.

comment:2 by boris-petrov, 3 days ago

Resolution: fixed
Status: newclosed

That's indeed true! The new scale filter syntax resolves this issue. Thanks!

Note: See TracTickets for help on using tickets.