slhck/ffmpeg-quality-metrics

ffmpeg_quality_metrics.ffmpeg_quality_metrics.FfmpegQualityMetricsError: Your ffmpeg version does not have the filter 'libvmaf'

AdithyaRaman opened this issue · 5 comments

I have built my ffmpeg and libvmaf using the instructions found here.
But when I use ffmpeg_quality_metrics to get vmaf scores of a video, I get the below error

adithya@amaramindu:~/ub/ub/research/simulators/video_encoding$ ffmpeg_quality_metrics encodedVideos/h264/tos_320x180_300k_24.mp4 /media/adithya/SanDisk/big_buck_bunny_1080p24.y4m --metrics vmaf -p -of csv >> encodedVideos/h264/qualityMetricsOutputs/phoneModel/tos_320x180_300k_24.csv
Traceback (most recent call last):
  File "/home/adithya/miniconda3/bin/ffmpeg_quality_metrics", line 8, in <module>
    sys.exit(main())
  File "/home/adithya/miniconda3/lib/python3.9/site-packages/ffmpeg_quality_metrics/__main__.py", line 156, in main
    ffqm.calc(metrics, vmaf_options=vmaf_options)
  File "/home/adithya/miniconda3/lib/python3.9/site-packages/ffmpeg_quality_metrics/ffmpeg_quality_metrics.py", line 240, in calc
    raise FfmpegQualityMetricsError(
ffmpeg_quality_metrics.ffmpeg_quality_metrics.FfmpegQualityMetricsError: Your ffmpeg version does not have the filter 'libvmaf'

But when I check ffmpeg to see if libvmaf has been enabled I do notice the --enable-libvmaf which indicates that ffmpeg picked up the libvmaf library


adithya@amaramindu:~/ub/ub/research/simulators/video_encoding$ ffmpeg
ffmpeg version N-104701-g939711905a Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04)
  configuration: --enable-gpl --enable-libx264 --enable-nonfree --enable-libvmaf --enable-version3
  WARNING: library configuration mismatch
  avutil      configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avcodec     configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avformat    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avdevice    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avfilter    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  swscale     configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  swresample  configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  postproc    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Would appreciate some help as to why I get the error that libvmaf filter not existed.

Edit : I did notice a similar issue in this thread (Netflix/vmaf#547), however it did not offer a concrete solution to my issue.

slhck commented

This seems to be a path issue.

Your program is installed in home/adithya/miniconda3/bin. Make sure that the PATH within miniconda contains the path of the ffmpeg binary you built. My guess is that it favors the system path (e.g. /usr/bin), where there will likely be an older version of ffmpeg.

slhck commented

Perhaps try:

PATH="$HOME/bin:$PATH" ffmpeg_quality_metrics

What I also noted is that libvmaf does not seem to be recognized even with the FFMpeg command even though --enable-libvmaf is configured.

adithya@amaramindu:~/ub/ub/research/simulators$ ffmpeg  -r 24 -i /media/adithya/SanDisk/big_buck_bunny_1080p24.y4m -r 24 -i video_encoding/encodedVideos/h264/tos_1920x1080_4300k_24.mp4 -lavfi "[0:v]setpts=PTS-STARTPTS[reference]; [1:v]setpts=PTS-STARTPTS[distorted]; [distorted][reference]libvmaf=log_fmt=xml:log_path=/dev/stdout:model_path=/usr/local/share/model/vmaf_v0.6.1.pkl" -f null -
ffmpeg version N-104701-g939711905a Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04)
  configuration: --enable-libvmaf
  WARNING: library configuration mismatch
  avutil      configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avcodec     configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avformat    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avdevice    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  avfilter    configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  swscale     configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  swresample  configuration: --enable-libx264 --enable-gpl --cc='gcc -m64 -fPIC' --enable-shared
  libavutil      57.  9.101 / 57.  9.101
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59.  9.102 / 59.  9.102
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 17.100 /  8. 17.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
Input #0, yuv4mpegpipe, from '/media/adithya/SanDisk/big_buck_bunny_1080p24.y4m':
  Duration: 00:09:56.46, start: 0.000000, bitrate: 597197 kb/s
  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24 tbn
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'video_encoding/encodedVideos/h264/tos_1920x1080_4300k_24.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.9.102
  Duration: 00:09:56.46, start: 0.000000, bitrate: 3406 kb/s
  Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3404 kb/s, 24 fps, 24 tbr, 12288 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
[AVFilterGraph @ 0x55b9f0527b00] No such filter: 'libvmaf'
Error initializing complex filters.
Invalid argument

I suspected my ffmpeg is not picking up the path to where I installed vmaf and I would need to fix this before I fix the path in miniconda

slhck commented

In that case it's not a path issue at all. Does "ffmpeg -filters" not list VMAF? Then it's a build issue. Did you accidentally disable some features while building?

Note that the static builds (e.g. from John van Sickle) have VMAF compiled in already.

Using the static build fixed it. You were right. Must have been a problem in my build