I have encountered a strange problem. When using ffmpeg provided in javacpp-presets to perform an overlay operation on two videos, if the video at the bottom is in motion, the video at the top becomes blurry. However, when I use locally compiled ffmpeg to execute the same command, there is no such problem. I have tried presets 5.x and 6.x, and the same problem occurs. Who can help me?
command:
.javacpp/cache/ffmpeg-5.0-1.5.7-macosx-x86_64.jar/org/bytedeco/ffmpeg/macosx-x86_64/ffmpeg -y -f lavfi -i color=c=black:s=1920x1080 -i a.mp4 -i b.mp4 -i c.mp4 -filter_complex "[2:v][3:v]alphamerge[alphamerge0];[1:v]scale=1920x1080[out0];[0:v][out0]overlay=enable='between(t,0.0,40.141)':x=0.0:y=0.0[overlay0];[overlay0][alphamerge0]overlay=enable='between(t,0.0,40.141)':x=0.0:y=0.0[out]" -preset medium -t 00:00:40.141 -crf 20 -vcodec h264 -map "[out]" -profile:v high -force_key_frames "expr:gte(t,n_forced*8)" out.mp4
I have tried to change preset,crf,codec,profile and so on, nothing works.
blurry ffmpeg version:
.javacpp/cache/ffmpeg-5.0-1.5.7-macosx-x86_64.jar/org/bytedeco/ffmpeg/macosx-x86_64/ffmpeg -version
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=.. --disable-iconv --disable-opencl --disable-sdl2 --disable-bzlib --disable-lzma --disable-linux-perf --disable-xlib --enable-shared --enable-version3 --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-openssl --enable-libopenh264 --enable-libvpx --enable-libfreetype --enable-libopus --enable-libxml2 --enable-libsrt --enable-libwebp --enable-pthreads --enable-indev=avfoundation --disable-libxcb --extra-cflags='-I../include/ -I../include/libxml2' --extra-ldflags=-L../lib/ --extra-libs='-lstdc++ -ldl -lz -lm'
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
normal local version:
ffmpeg -version
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100