Netflix / vmaf

Perceptual video quality assessment based on multi-method fusion.
Other
4.51k stars 750 forks source link

ERROR segmentation fault (core dumbed): /usr/local/share/model/vmaf_v0.6.1.json #1358

Closed uthay45 closed 3 months ago

uthay45 commented 6 months ago

[mcw@localhost linux]$ ./x265 --input /mnt/Cajon/testsequences/BasketballDrive_3840x2160_50.yuv --input-res 3840x2160 --fps 50 --recon recon.yuv -o out.hevc --csv out.csv yuv [info]: 3840x2160 fps 50000/1000 i420p8 frames 0 - 500 of 501 yuv [info]: reconstructed images 3840x2160 fps 50000/1000 i420 raw [info]: output file: out.hevc x265 [info]: HEVC encoder version 3.5+119-e112940 x265 [info]: build info [Linux][GCC 12.2.0][64 bit] 10bit x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 x265 [info]: Main 10 profile, Level-5.1 (Main tier) x265 [info]: Thread pool 0 using 44 threads on numa nodes 0 x265 [info]: Thread pool 1 using 44 threads on numa nodes 1 x265 [info]: Slices : 1 x265 [info]: frame threads / pool features : 6 / wpp(34 rows) x265 [info]: Coding QT: max CU size, min CU size : 64 / 8 x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3 x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00 x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2 x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0 x265 [info]: References / ref-limit cu / depth : 3 / off / on x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1 x265 [info]: Rate Control / qCompress : CRF-28.0 / 0.60 x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp x265 [info]: tools: b-intra strong-intra-smoothing lslices=8 deblock sao libvmaf INFO compute_vmaf() is deprecated and will be removed in a future libvmaf version Segmentation fault (core dumped)

someone please help me to resolve this error. i used vmaf_v0.6.1.json file for model file beoz from vmaf v2.x they deprecated .pkl file instead they told to use .json format file. I enabled libvmaf using cmake.

kylophone commented 6 months ago

This looks like x265, maybe ask about this on their issue tracker? Also, it seems you are using an older version of libvmaf as compute_vmaf() has been removed since v3.0.

uthay45 commented 6 months ago

Yeah u are right compute_vmaf is deprecated since v3.0. but I got the same error even If I use v2.3.1 and v2.0.0

nilfm99 commented 6 months ago

Could you provide more details on your OS, how you built libvmaf, x265, and how they are linked together? I can try to reproduce this.

uthay45 commented 6 months ago

vmaf built: wget https://github.com/Netflix/vmaf/archive/refs/tags/v2.3.1.tar.gz tar -xzf v2.3.1.tar.gz cd vmaf-2.3.1/libvmaf/ meson setup build --buildtype release ninja -vC build ninja -vC build test ninja -vC build install

x265 built: git clone https://bitbucket.org/multicoreware/x265_git.git cd x265_git cd /build/linux ./make-Makefiles.bash (while running this i change enable_libvmaf to ON and enable_shared to OFF) make -j8 sudo make install

OS info : Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 88 On-line CPU(s) list: 0-87 Thread(s) per core: 2 Core(s) per socket: 22 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 79 Model name: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz Stepping: 1 CPU MHz: 3254.614 CPU max MHz: 3600.0000 CPU min MHz: 1200.0000 BogoMIPS: 4399.92 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 56320K NUMA node0 CPU(s): 0-21,44-65 NUMA node1 CPU(s): 22-43,66-87

nilfm99 commented 6 months ago

Thanks for the details, I was able to reproduce your issue.

My observations:

  1. If libvmaf v3.0.0 is installed and x265 is linked against it, it won't even compile because it won't find compute_vmaf.
  2. If libvmaf v2.3.1 is installed, x265 will compile and link against it. When running, it will fail due to multiple reasons:

Looking for a pkl model

Because the model is hardcoded here to vmaf_v0.6.1.pkl, and we removed support for pkl model files in favor of json some time ago, it won't work as-is. I tried changing that line to vmaf_v0.6.1.json, and then moved into the next error. Note: I don't know why this wasn't a problem for you.

Segmentation fault

I could repro your segmentation fault and root caused it to bitdepth_map. This is because the format string passed into compute_vmaf is NULL. This comes again from this line - vcd is defined in this way and I can't find anywhere it is modified, and then it passes the null pointer into compute_vmaf here.

This seems to be a problem on x265's end, and nontrivial for someone without x265 knowledge to get right. I tried hardcoding the pixel format that I'm working with (yuv420p10le) in that line, recompiling, and voila:

Summary Command, Date/Time, Elapsed Time, FPS, Bitrate, Y PSNR, U PSNR, V PSNR, Global PSNR, SSIM, SSIM (dB), I count, I ave-QP, I kbps, I-PSNR Y, I-PSNR U, I-PSNR V, I-SSIM (dB), P count, P ave-QP, P kbps, P-PSNR Y, P-PSNR U, P-PSNR V, P-SSIM (dB), B count, B ave-QP, B kbps, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM (dB), MaxCLL, MaxFALL, Aggregate VMAF score, Version " -o input/output.hevc --recon input/recon.yuv --input-res 4096x2160 --fps 25 --log-level full --csv-log-level 2 --csv out.csv input/out_4096x2160_10b.yuv", Fri Apr 5 21:25:07 2024, 30.86, 0.19, 548.60, -, -, -, -, -, -, 1 , 33.48, 1683.40 , -, -, -, -, 5 , 32.72, 321.64 , -, -, -, -, -, -, -, -, -, -, -, 83 , 30 , 99.462032, 3.6+1-dd1ef69b2 0, I-SLICE, 0, 33.48, 67336, 0,25.087,5, -, -, 0.00%, 0.00%, 0.00%, 0.76%, 0.00%, 35.10%, 0.00%, 0.00%, 60.89%, 0.00%, 0.00%, 3.25%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00% 0, I-SLICE, 0, 33.48, 67336, 0,25.087,5, -, -, 0.00%, 0.00%, 0.00%, 0.76%, 0.00%, 35.10%, 0.00%, 0.00%, 60.89%, 0.00%, 0.00%, 3.25%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00% 1, P-SLICE, 1, 32.54, 50304, 0,28.000,4, 0 , -, 0.00%, 0.00%, 0.00%, 1.46%, 0.02%, 37.96%, 0.42%, 0.01%, 48.59%, 0.00%, 0.01%, 9.59%, 0.00%, 0.00%, 0.00%, 0.06%, 0.01%, 0.00%, 0.00%, 0.57%, 0.00%, 0.00%, 0.00%, 1.32%, 0.00% 2, P-SLICE, 2, 33.00, 2328, 0,28.000,3, 1 0 , -, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 44.06%, 49.21%, 6.73%, 0.00% 3, P-SLICE, 3, 32.07, 8960, 0,28.000,2, 2 1 0 , -, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 1.78%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.85%, 8.06%, 0.00%, 0.00%, 0.00%, 0.49%, 0.00%, 0.00%, 46.26%, 35.57%, 6.99%, 0.00% 4, P-SLICE, 4, 33.00, 1344, 0,28.000,1, 3 2 1 , -, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 84.62%, 5.13%, 10.26%, 0.00% 5, P-SLICE, 5, 33.00, 1392, 0,28.000,0, 4 3 2 , -, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 0.00%, 84.62%, 5.13%, 10.26%, 0.00%

Summary Command, Date/Time, Elapsed Time, FPS, Bitrate, Y PSNR, U PSNR, V PSNR, Global PSNR, SSIM, SSIM (dB), I count, I ave-QP, I kbps, I-PSNR Y, I-PSNR U, I-PSNR V, I-SSIM (dB), P count, P ave-QP, P kbps, P-PSNR Y, P-PSNR U, P-PSNR V, P-SSIM (dB), B count, B ave-QP, B kbps, B-PSNR Y, B-PSNR U, B-PSNR V, B-SSIM (dB), Aggregate VMAF score, Version " -o input/output.hevc --recon input/recon.yuv --input-res 4096x2160 --fps 25 --log-level full --csv-log-level 1 --csv out.csv input/out_4096x2160_10b.yuv", Fri Apr 5 21:25:53 2024, 4.24, 1.41, 548.60, -, -, -, -, -, -, 1 , 33.48, 1683.40 , -, -, -, -, 5 , 32.72, 321.64 , -, -, -, -, -, -, -, -, -, -, -, 99.462032, 3.6+1-dd1ef69b2



I would suggest opening an issue at x265 mentioning this one, and we can try to help with the fix and maybe with upgrading to the newer libvmaf API to avoid the incompatibility with v3.0.0.
nilfm99 commented 6 months ago

Here is what my vcd definition looked like after both changes:

static const x265_vmaf_commondata vcd[] = { { (char*)"yuv420p10le", (char *)"/usr/local/share/model/vmaf_v0.6.1.json", NULL, NULL, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 1, 0 } };
uthay45 commented 5 months ago

Thankyou so much @nilfm99 now i can able to run without any error . I have one question : if they removed compute_vmaf from the v3.0.0 , so whats the new API to calculate vmaf score in libvmaf. whats the alternative?

nilfm99 commented 5 months ago

@uthay45 The new API is here: https://github.com/Netflix/vmaf/blob/master/libvmaf/include/libvmaf/libvmaf.h

You can see an example usage in the vf_libvmaf ffmpeg filter here: https://github.com/FFmpeg/FFmpeg/blob/master/libavfilter/vf_libvmaf.c

For x265, this should be simpler because they are only interested in one hardcoded model, and no extra features.


Leaving aside the new API, I do see some complications with fixing the current state of x265 <-> vmaf interaction. Most importantly, if x265_max_bit_depth does not match the source bit depth, the encode and reconstructed videos will be a different bit depth from the source, and will need to be reconciled to some common bit depth before passing the data to libvmaf.

now i can able to run without any error

note that the results will only be correct (assuming no other errors in the x265 code that I may have missed) if you use videos with the same bit depth that you compiled with.

uthay45 commented 5 months ago

Thanks For your information @nilfm99