slhck/ffmpeg-quality-metrics

[Windows] Still issues with ffmpeg-commands and file-paths in filter-graphs for me

e-d-n-a opened this issue · 6 comments

I had issues trying to get your package to run on Windows.

I saw Issue #6, but those paths didn't work for me and were different from what I saw working using FFMetrics.
Actually working for me were ffmpeg-commands with filtergraphs like this:

[1][0]scale2ref=flags=bicubic[dist][ref];[dist]setpts=PTS-STARTPTS[distpts];[ref]setpts=PTS-STARTPTS[refpts];[distpts]split[dist1][dist2];[refpts]split[ref1][ref2];[dist1][ref1]psnr='C\:/Users/xxx/AppData/Local/Temp/u896z4mg-psnr.txt';[dist2][ref2]ssim='C\:/Users/xxx/AppData/Local/Temp/9o142917-ssim.txt'

So 'C\:/[...]' instead of 'C\\:/[...]' and single-quotes around the settings of any quality metric.

Together with other minor changes (fixing #20, #21 and #22), this worked for me:
__main__.py

Tested on Windows 7-x64 SP1 with Python-x32 3.7.4 and ffmpeg 4.3.1-2020-11-19-full in CMD-Shell.

slhck commented

Thanks for raising this issue and the others. I will review the changes and incorporate them. I'm currently not in front of a computer and it'll take a few days for me to get to it though.

slhck commented

I reviewed your changes and made the necessary fixes in a different branch: #24

Does this work for you — or are there more changes required?

Thanks again for your contributions. In the future, I'd appreciate if you could split up any suggested changes into separate pull requests, each covering one issue. That'd make it easier to review and merge them without having to compare the code manually.

I tested your proposed fix (altered slash-syntax and quotes around vmaf-options), but still get an error with that:

>ffmpeg_quality_metrics 480p_0-5s.mp4 1080p_0-5s.mp4 -of json > test.json
ERROR: error running command: ffmpeg -hide_banner -nostdin -y -threads 4 -r 30.0 -i 1080p_0-5s.mp4 -r 30.0 -
i 480p_0-5s.mp4 -filter_complex [1][0]scale2ref=flags=bicubic[dist][ref];[dist]setpts=PTS-STARTPTS[distpts];
[ref]setpts=PTS-STARTPTS[refpts];[distpts]split[dist1][dist2];[refpts]split[ref1][ref2];[dist1][ref1]psnr=C\
:/Users/xxx/AppData/Local/Temp/95rlig2z-psnr.txt;[dist2][ref2]ssim=C\:/Users/xxx/AppData/Local/Temp/h3vut6u4-s
sim.txt -an -f null NUL
ERROR: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1080p_0-5s.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:05.02, start: 0.000000, bitrate: 3464 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2336x1080 [SAR 1:1 DAR 292:135], 8085
 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '480p_0-5s.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:05.02, start: 0.000000, bitrate: 327 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1038x480 [SAR 4096:4095 DAR 44288:204
75], 472 kb/s, SAR 4672:4671 DAR 292:135, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[psnr @ 0000000000464f00] [Eval @ 00000000003ae930] Undefined constant or missing '(' in '/Users/xxx/AppData/
Local/Temp/95rlig2z-psnr.txt'
[psnr @ 0000000000464f00] Unable to parse option value "/Users/xxx/AppData/Local/Temp/95rlig2z-psnr.txt"
[psnr @ 0000000000464f00] [Eval @ 00000000003ae940] Undefined constant or missing '(' in '/Users/xxx/AppData/
Local/Temp/95rlig2z-psnr.txt'
[psnr @ 0000000000464f00] Unable to parse option value "/Users/xxx/AppData/Local/Temp/95rlig2z-psnr.txt"
[psnr @ 0000000000464f00] Error setting option stats_version to value /Users/xxx/AppData/Local/Temp/95rlig2z-
psnr.txt.
[Parsed_psnr_5 @ 0000000000464e00] Error applying options to the filter.
[AVFilterGraph @ 00000000004abb80] Error initializing filter 'psnr' with args 'C:/Users/xxx/AppData/Local/Tem
p/95rlig2z-psnr.txt'
Error initializing complex filters.
Invalid argument

So quotes around the options for psnr- and ssim-filters seem necessary too, as I suggested before:

            f"[dist1][ref1]psnr='{win_path_check(temp_file_name_psnr)}'",
            f"[dist2][ref2]ssim='{win_path_check(temp_file_name_ssim)}'",

With them it works! (TESTED)

slhck commented

Thanks, I forgot those. Since I manually had to apply the changes you proposed, I simply didn't spot them.

Merged now!

Well, I thought you could easily use a diff-tool to compare the files! ;-)

slhck commented

I did! 😄 I was just too tired and forgot that hunk.