Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg memory leak on v0.7.13 #189

Closed
pvelati opened this issue Feb 8, 2024 · 8 comments · Fixed by #255
Closed

ffmpeg memory leak on v0.7.13 #189

pvelati opened this issue Feb 8, 2024 · 8 comments · Fixed by #255

Comments

@pvelati
Copy link

pvelati commented Feb 8, 2024

Hello, I'm having issue using latest release v0.7.13.
During a vmaf comparison, I see a linear increase of memory usage for ffpmeg until it gets killed.

It's running on a Debian 12 KVM VM with 32 vcpu and 32GB memory

ffmpeg version 6.0.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-gnutls --disable-liblensfun --disable-libopencv --disable-podpages --disable-sndio --disable-stripping --enable-avfilter --enable-chromaprint --enable-frei0r --enable-gcrypt --enable-gpl --enable-ladspa --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdavs2 --enable-libdc1394 --enable-libdrm --enable-libfdk-aac --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libkvazaar --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librsvg --enable-librubberband --enable-libshine --enable-libsmbclient --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-nonfree --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-openssl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --enable-vulkan --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-vaapi --enable-libvpl --enable-libvmaf --enable-libilbc --enable-libjxl --cc=x86_64-linux-gnu-gcc --cxx=x86_64-linux-gnu-g++ --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100

# dpkg --list | grep vmaf
ii  libvmaf1:amd64                  2.3.1-dmo2                          amd64        Video Multi-Method Assessment Fusion - runtime library
ii  python3-vmaf                    2.3.1-dmo2                          amd64        Video Multi-Method Assessment Fusion - python3 bindings
ii  vmaf                            2.3.1-dmo2                          amd64        Video Multi-Method Assessment Fusion.
ii  vmaf-models                     2.3.1-dmo2                          all          Video Multi-Method Assessment Fusion - defaults models

With previous version v0.7.12 I don't have problems.
With direct ffmpeg (the one from the wiki) I don't have problems.

ffmpeg -i distorted.x265.mp4 -i original.mp4 -lavfi libvmaf -f null -

Command used:

ab-av1 vmaf --reference original.mp4 --distorted distorted.x265.mp4

journal logs

Feb 08 23:36:40 encoder kernel: ffmpeg invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0
Feb 08 23:36:40 encoder kernel: CPU: 0 PID: 1793 Comm: ffmpeg Not tainted 6.1.0-17-amd64 #1  Debian 6.1.69-1
Feb 08 23:36:40 encoder kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014
Feb 08 23:36:40 encoder kernel: Call Trace:
Feb 08 23:36:40 encoder kernel:  <TASK>
Feb 08 23:36:40 encoder kernel:  dump_stack_lvl+0x44/0x5c
Feb 08 23:36:40 encoder kernel:  dump_header+0x4a/0x211
Feb 08 23:36:40 encoder kernel:  oom_kill_process.cold+0xb/0x10
Feb 08 23:36:40 encoder kernel:  out_of_memory+0x1fd/0x4c0
Feb 08 23:36:40 encoder kernel:  __alloc_pages_slowpath.constprop.0+0xc73/0xdc0
Feb 08 23:36:40 encoder kernel:  __alloc_pages+0x305/0x330
Feb 08 23:36:40 encoder kernel:  folio_alloc+0x17/0x50
Feb 08 23:36:40 encoder kernel:  __filemap_get_folio+0x155/0x340
Feb 08 23:36:40 encoder kernel:  filemap_fault+0x139/0x910
Feb 08 23:36:40 encoder kernel:  ? filemap_map_pages+0x153/0x700
Feb 08 23:36:40 encoder kernel:  __do_fault+0x33/0x110
Feb 08 23:36:40 encoder kernel:  do_fault+0x1b9/0x410
Feb 08 23:36:40 encoder kernel:  __handle_mm_fault+0x660/0xfa0
Feb 08 23:36:40 encoder kernel:  handle_mm_fault+0xdb/0x2d0
Feb 08 23:36:40 encoder kernel:  do_user_addr_fault+0x191/0x580
Feb 08 23:36:40 encoder kernel:  exc_page_fault+0x70/0x170
Feb 08 23:36:40 encoder kernel:  asm_exc_page_fault+0x22/0x30
Feb 08 23:36:40 encoder kernel: RIP: 0033:0x7eff8bf25ecd
Feb 08 23:36:40 encoder kernel: Code: Unable to access opcode bytes at 0x7eff8bf25ea3.
Feb 08 23:36:40 encoder kernel: RSP: 002b:00007efea77eccb8 EFLAGS: 00010206
Feb 08 23:36:40 encoder kernel: RAX: 000000000018ba00 RBX: 00000000000001ad RCX: 00007eff8bf4086c
Feb 08 23:36:40 encoder kernel: RDX: 00000000000001a7 RSI: 0000000000000590 RDI: 0000000000000590
Feb 08 23:36:40 encoder kernel: RBP: 00007efea77ed060 R08: 00007efe57fe5040 R09: 00007efe4a23c040
Feb 08 23:36:40 encoder kernel: R10: 00007efe4b22c040 R11: 0000000000000f00 R12: 00007efe57fe8d40
Feb 08 23:36:40 encoder kernel: R13: 00007efe57ff0740 R14: 00007efe57feca40 R15: 00007efe57ff4440
Feb 08 23:36:40 encoder kernel:  </TASK>
Feb 08 23:36:40 encoder kernel: Mem-Info:
Feb 08 23:36:40 encoder kernel: active_anon:1052604 inactive_anon:7050636 isolated_anon:0
                                 active_file:71 inactive_file:824 isolated_file:0
                                 unevictable:0 dirty:0 writeback:20
                                 slab_reclaimable:7007 slab_unreclaimable:16329
                                 mapped:221 shmem:205 pagetables:17146
                                 sec_pagetables:0 bounce:0
                                 kernel_misc_reclaimable:0
                                 free:50130 free_pcp:48 free_cma:0
Feb 08 23:36:40 encoder kernel: Node 0 active_anon:4210416kB inactive_anon:28202544kB active_file:284kB inactive_file:3296kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:884kB dirty:0kB writeback:80kB shmem:820kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 25321472kB writeback_tmp:0kB kernel_stack:8320kB pagetables:68584kB sec_pagetables:0kB all_unreclaimable? yes
Feb 08 23:36:40 encoder kernel: Node 0 DMA free:11264kB boost:0kB min:28kB low:40kB high:52kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15360kB mlocked:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
Feb 08 23:36:40 encoder kernel: lowmem_reserve[]: 0 1937 32036 32036 32036
Feb 08 23:36:40 encoder kernel: Node 0 DMA32 free:124476kB boost:0kB min:4084kB low:6068kB high:8052kB reserved_highatomic:0KB active_anon:25784kB inactive_anon:1856320kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:2080588kB managed:2015052kB mlocked:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
Feb 08 23:36:40 encoder kernel: lowmem_reserve[]: 0 0 30098 30098 30098
Feb 08 23:36:40 encoder kernel: Node 0 Normal free:64780kB boost:0kB min:63464kB low:94284kB high:125104kB reserved_highatomic:6144KB active_anon:4184628kB inactive_anon:26346196kB active_file:0kB inactive_file:2920kB unevictable:0kB writepending:80kB present:31457280kB managed:30828616kB mlocked:0kB bounce:0kB free_pcp:192kB local_pcp:0kB free_cma:0kB
Feb 08 23:36:40 encoder kernel: lowmem_reserve[]: 0 0 0 0 0
Feb 08 23:36:40 encoder kernel: Node 0 DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 1*1024kB (U) 1*2048kB (M) 2*4096kB (M) = 11264kB
Feb 08 23:36:40 encoder kernel: Node 0 DMA32: 23*4kB (UM) 76*8kB (U) 90*16kB (UM) 47*32kB (UE) 28*64kB (UME) 10*128kB (U) 8*256kB (UME) 4*512kB (ME) 1*1024kB (E) 1*2048kB (M) 27*4096kB (M) = 124476kB
Feb 08 23:36:40 encoder kernel: Node 0 Normal: 111*4kB (UME) 198*8kB (UMEH) 45*16kB (UMEH) 177*32kB (ME) 303*64kB (UME) 93*128kB (ME) 24*256kB (UME) 16*512kB (UME) 5*1024kB (UM) 1*2048kB (M) 1*4096kB (M) = 65308kB
Feb 08 23:36:40 encoder kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Feb 08 23:36:40 encoder kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Feb 08 23:36:40 encoder kernel: 47805 total pagecache pages
Feb 08 23:36:40 encoder kernel: 46558 pages in swap cache
Feb 08 23:36:40 encoder kernel: Free swap  = 0kB
Feb 08 23:36:40 encoder kernel: Total swap = 998396kB
Feb 08 23:36:40 encoder kernel: 8388465 pages RAM
Feb 08 23:36:40 encoder kernel: 0 pages HighMem/MovableOnly
Feb 08 23:36:40 encoder kernel: 173708 pages reserved
Feb 08 23:36:40 encoder kernel: 0 pages hwpoisoned
Feb 08 23:36:40 encoder kernel: Tasks state (memory values in pages):
Feb 08 23:36:40 encoder kernel: [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Feb 08 23:36:40 encoder kernel: [    509]     0   509    10281      775   110592        0          -250 systemd-journal
Feb 08 23:36:40 encoder kernel: [    534]     0   534     6548      451    73728        0         -1000 systemd-udevd
Feb 08 23:36:40 encoder kernel: [    622]   997   622    22515      220    69632        0             0 systemd-timesyn
Feb 08 23:36:40 encoder kernel: [    729]     0   729     1467      205    45056        5             0 dhclient
Feb 08 23:36:40 encoder kernel: [    840]     0   840     1652       36    49152        0             0 cron
Feb 08 23:36:40 encoder kernel: [    841]   100   841     2304      148    57344        0          -900 dbus-daemon
Feb 08 23:36:40 encoder kernel: [    843]     0   843    20060       69    57344        0             0 qemu-ga
Feb 08 23:36:40 encoder kernel: [    845]     0   845     4291      252    69632        0             0 systemd-logind
Feb 08 23:36:40 encoder kernel: [    848]     0   848     1468       23    53248        0             0 agetty
Feb 08 23:36:40 encoder kernel: [    852]     0   852     3853      333    77824        0         -1000 sshd
Feb 08 23:36:40 encoder kernel: [    856]     0   856     4573      451    73728       81             0 sshd
Feb 08 23:36:40 encoder kernel: [    859]     0   859     4723      401    73728        0           100 systemd
Feb 08 23:36:40 encoder kernel: [    860]     0   860    42160      698    86016       55           100 (sd-pam)
Feb 08 23:36:40 encoder kernel: [    879]     0   879     4496      455    73728        0             0 sshd
Feb 08 23:36:40 encoder kernel: [    881]     0   881     2124       25    53248      430             0 bash
Feb 08 23:36:40 encoder kernel: [    888]     0   888      661       21    40960        0             0 sftp-server
Feb 08 23:36:40 encoder kernel: [    923]     0   923     2155       89    57344      207             0 tmux: server
Feb 08 23:36:40 encoder kernel: [    930]     0   930     1827        2    53248      148             0 bash
Feb 08 23:36:40 encoder kernel: [   1429]     0  1429     1799        1    45056      141             0 bash
Feb 08 23:36:40 encoder kernel: [   1512]     0  1512     1181      545    45056       35             0 ab-av1
Feb 08 23:36:40 encoder kernel: [   1592]     0  1592  9757214  8048076 69050368   250108             0 ffmpeg
Feb 08 23:36:40 encoder kernel: [   2004]     0  2004     2488      675    57344        0             0 htop
Feb 08 23:36:40 encoder kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-0.slice/session-1.scope,task=ffmpeg,pid=1592,uid=0
Feb 08 23:36:40 encoder kernel: Out of memory: Killed process 1592 (ffmpeg) total-vm:39028856kB, anon-rss:32192304kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:67432kB oom_score_adj:0
Feb 08 23:36:40 encoder systemd[1]: session-1.scope: A process of this unit has been killed by the OOM killer.

can it be related to this change? #177

@alexheretic
Copy link
Owner

I would assume then this is an upstream bug. Can you run it and lookup the exact ffmpeg args ab-av1 is using, then you can reproduce it just using ffmpeg and report upstream.

We have changed to use a single ffmpeg call, but that shouldn't cause it to oom. It also may be worth trying with the latest ffmpeg build if you haven't already.

@pvelati
Copy link
Author

pvelati commented Feb 10, 2024

The ffmpeg command for ab-av1 vmaf --reference original.mp4 --distorted distorted.x265.mp4 that I see is

ffmpeg -r 24 -i original.mp4 -r 24 -i distorted.x265.mp4 -filter_complex [0:v]format=yuv444p10le,scale=3840:-1:flags=bicubic,setpts=PTS-STARTPTS[dis];[1:v]format=yuv444p10le,scale=3840:-1:flags=bicubic,setpts=PTS-STARTPTS[ref];[dis][ref]libvmaf=n_threads=4:model=version=vmaf_4k_v0.6.1 -f null -

tried also with version 6.1 of ffmpeg

ffmpeg version 6.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100

and the 20240203 build

ffmpeg version N-68533-gcc774cd962-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      58. 36.101 / 58. 36.101
  libavcodec     60. 38.100 / 60. 38.100
  libavformat    60. 20.100 / 60. 20.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100

with the same memory leak

@pvelati
Copy link
Author

pvelati commented Feb 10, 2024

tried directly with the ffmpeg command and the memory leak persists.

# ffmpeg -r 24 -i original.mp4 -r 24 -i distorted.x265.mp4 -filter_complex "[0:v]format=yuv444p10le,scale=3840:-1:flags=bicubic,setpts=PTS-STARTPTS[dis];[1:v]format=yuv444p10le,scale=3840:-1:flags=bicubic,setpts=PTS-STARTPTS[ref];[dis][ref]libvmaf=n_threads=4:model=version=vmaf_4k_v0.6.1" -f null -
ffmpeg version N-68533-gcc774cd962-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      58. 36.101 / 58. 36.101
  libavcodec     60. 38.100 / 60. 38.100
  libavformat    60. 20.100 / 60. 20.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'original.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.24.100
  Duration: 00:20:58.56, start: 0.000000, bitrate: 100203 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 2704x1520 [SAR 1:1 DAR 169:95], 100002 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
      Metadata:
        handler_name    : GoPro AVC
        vendor_id       : [0][0][0][0]
        timecode        : 20:54:48:12
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
      Metadata:
        handler_name    : GoPro AAC
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74)
      Metadata:
        handler_name    : GoPro AVC
        timecode        : 20:54:48:12
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'distorted.x265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf60.3.100
  Duration: 00:20:58.56, start: 0.000000, bitrate: 22618 kb/s
  Stream #1:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, bt709, progressive), 2704x1520 [SAR 1:1 DAR 169:95], 22465 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc60.3.100 libx265
  Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 139 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 (h264) -> format:default (graph 0)
  Stream #1:0 (hevc) -> format:default (graph 0)
  libvmaf:default (graph 0) -> Stream #0:0 (wrapped_avframe)
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[swscaler @ 0x7fd158083400] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 3 times
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.20.100
  Stream #0:0: Video: wrapped_avframe, yuv444p10le(unknown/bt709/bt709, progressive), 3840x2159 [SAR 364871:364800 DAR 169:95], q=2-31, 200 kb/s, 24 fps, 24 tbn
      Metadata:
        encoder         : Lavc60.38.100 wrapped_avframe
  Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
      Metadata:
        handler_name    : GoPro AAC
        vendor_id       : [0][0][0][0]
        encoder         : Lavc60.38.100 pcm_s16le
Killed  107 fps=3.2 q=-0.0 size=N/A time=00:00:04.13 bitrate=N/A speed=0.125x

@pvelati
Copy link
Author

pvelati commented Feb 11, 2024

using v0.7.12 the commands for ab-av1 vmaf --reference original.mp4 --distorted distorted.x265.mp4 are

ffmpeg -r 24 -i original.mp4 -pix_fmt yuv444p10le -vf setpts=PTS-STARTPTS -strict -1 -f yuv4mpegpipe -
ffmpeg -r 24 -i distorted.x265.mp4 -pix_fmt yuv444p10le -vf setpts=PTS-STARTPTS -strict -1 -f yuv4mpegpipe -y /tmp/ab-av1-iMnYDvFi9MZ5.fifo
ffmpeg -i /tmp/ab-av1-iMnYDvFi9MZ5.fifo -i - -filter_complex [0:v]scale=3840:-1:flags=bicubic[dis];[1:v]scale=3840:-1:flags=bicubic[ref];[dis][ref]libvmaf=n_threads=32:model=version=vmaf_4k_v0.6.1 -f null -

@alexheretic
Copy link
Owner

Does this still occur on latest ffmpeg? I think this is best reported upstream, unless there is some issue with how we are using ffmpeg.

@AgentOak
Copy link

AgentOak commented Aug 16, 2024

This is a long standing bug in ffmpeg+libvmaf that I hit all the time. You only really notice when comparing long videos since the leak grows linearly with video length. The 20s samples for auto-encode/crf-search are too small.

Not sure what the cause is. I have MP4s that reproduce the leak 100% of the time, but then other MP4s with the exact same settings that don't trigger it.

The workaround I found is to deselect all tracks except the 2 video tracks you want to compare, i.e. -map 0:v:0 -map 1:v:0 or -an -sn -dn. I don't think ab-av1 lets you do that currently.

@alexheretic
Copy link
Owner

The workaround I found is to deselect all tracks except the 2 video tracks you want to compare, i.e. -map 0:v:0 -map 1:v:0 or -an -sn -dn. I don't think ab-av1 lets you do that currently.

It's possible we could adapt the vmaf code to do this. Seems like it should work fine.

@alexheretic
Copy link
Owner

I merged #255 though I can't currently reproduce this issue. Please let me know if this is a successful workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants