JNoDuq / videobench

VMAF PSNR Bitrate Analyzer
226 stars 43 forks source link

problem loading model file: /usr/local/share/model/vmaf_float_v0.6.1.pkl #24

Open bryankanderson opened 3 years ago

bryankanderson commented 3 years ago

I have tried running this on Linux, MacOS, and Windows, with various different source files, but all of them end with the following error after analyzing the files:

problem loading model file: /usr/local/share/model/vmaf_float_v0.6.1.pkl [Parsed_libvmaf_4 @ 0x56271c705080] libvmaf encountered an error, check log for details Error while filtering: Invalid argument Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #1:0

Conversion failed!

cpw7922 commented 3 years ago

I seem to be having the same issue

libvmaf WARNING could not read model from path: "/usr/local/share/model/vmaf_float_v0.6.1.pkl"
libvmaf WARNING pkl model files have been deprecated, use json
libvmaf ERROR problem loading model file: /usr/local/share/model/vmaf_float_v0.6.1.pkl

[Parsed_libvmaf_4 @ 0x556104075980] libvmaf encountered an error, check log for details
Error while filtering: Invalid argument
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0

Conversion failed!

Traceback (most recent call last):
  File "/home/chris/Documents/Docker/videobench/videobench.py", line 223, in <module>
    data_json = json.load(open("{0}quality_{1}.json".format( tmp_path , input_obj.name)))
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/videobench/quality_BR_RIP_NAS.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chris/Documents/Docker/videobench/videobench.py", line 225, in <module>
    with open("{0}quality_{1}.json".format( tmp_path , input_obj.name), 'r') as file : #################### replace nan by 0
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/videobench/quality_BR_RIP_NAS.json'
bryankanderson commented 3 years ago

Due to lack of response, I tried using FFMPEG with libvmaf compiled in, actually got a similar error "Invalid argument" when invoking libvmaf. Ended up needing to massage the command string feeding to libvmaf as it is very sensitive to quote, double-quote, escaping, etc. After a lot of trial an error, I finally got it to work, so its probably something with the command that is invoking libvmaf is not formatted/escaped correctly.

cpw7922 commented 3 years ago

Glad to hear you got it to work. Can you share what the final command string that worked is?

bryankanderson commented 3 years ago

when using ffmpeg, the command for libvmaf was:

libvmaf="model_path=c:\:/ffmpeg-4.2.1/bin/vmaf_v0.6.1.pkl":log_path=VMAF_results.txt -report -f null -

This was on a Windows box with ffmpeg installed under C:. No docker was used, so not 100% sure how to translate this into this project.

marcelpoelstra commented 3 years ago

Please see https://github.com/JNoDuq/videobench/pull/27 This will fix the issue

cpw7922 commented 3 years ago

It seems like that fixed the issue but I am still having trouble getting the analysis to complete. The Docker file does appear to build and run without issues. When I look at the log from the docker container while the analysis is running it appears to work but I am still getting this at the end

edit: I also do not have vmaf_float_v0.6.1.pkl in /usr/local/share/model/ but I do have vmaf_v0.6.1.pkl and vmaf_4k_v0.6.1.pkl

* Analyzing Reference File...

-> BR_RIP.mp4 
 Bitrate  : 29.97 Mbps
 avg_framerate : 24.0
 interlaced : 0 

* Analyzing tests Files...

-> CM_NVENC_Trim.mp4 
 Bitrate : 9.69 Mbps
 avg_framerate : 24.0
 interlaced : 0 

* Quality measures...

-> CM_NVENC_Trim.mp4 
 Reference deint_filter : null
 VMAF Model : /usr/local/share/model/vmaf_float_v0.6.1.pkl
 Scale filter : scale=1920:1080:flags=neighbor
 Quality Subsampling : 1
 Calculate VMAF & PSNR (libvmaf)

libvmaf INFO `compute_vmaf()` is deprecated and will be removed in a future libvmaf version

libvmaf WARNING could not read model from path: "/usr/local/share/model/vmaf_float_v0.6.1.pkl"
libvmaf WARNING pkl model files have been deprecated, use json
frame=   24 fps=0.0 q=-0.0 size=N/A time=00:00:01.24 bitrate=N/A speed=2.46x    

Traceback (most recent call last):
  File "/home/xxxx/Documents/Docker/videobench/videobench.py", line 223, in <module>
    data_json = json.load(open("{0}quality_{1}.json".format( tmp_path , input_obj.name)))
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/videobench/quality_CM_NVENC_Trim.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xxxx/Documents/Docker/videobench/videobench.py", line 225, in <module>
    with open("{0}quality_{1}.json".format( tmp_path , input_obj.name), 'r') as file : #################### replace nan by 0
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/videobench/quality_CM_NVENC_Trim.json'
marcelpoelstra commented 3 years ago

The issue is clearly stated in the output : "libvmaf WARNING could not read model from path: "/usr/local/share/model/vmaf_float_v0.6.1.pkl"

This means that you did not do all the changes. Did you check-out my fork or did you do the changes manually? In any case, you need to rebuild the Docker container using the --no-cache option the first time after the changes, otherwise the model files do not get copied. This is one of the issues with the latest VMAF libraries, that 'make install' does no longer copy the model files. For that reason I included a forced move of these files in the Dockerfile Another thing is, your setup is apparently still using the depricated .pkl model files, while my changes are including the json model files instead. I think the best thing would be to clean out everything, so delete the videobench directory, and clear out the related docker leftovers like the built image, and check out my fork of this repostory and use that to start over.

cpw7922 commented 3 years ago

Sorry, didn't notice that you created a fork. Deleted everything and I downloaded your repo this time and it appears to be working. Thanks for the help!

bryankanderson commented 3 years ago

This fixed it for me, but please know that there are still a few things that need to be changed in order to run this under Windows, as noted here: https://github.com/JNoDuq/videobench/issues/17#issuecomment-636494683

Not saying you need to fix this in code, but adding it to the ReadMe would be helpful.