[FFmpeg-trac] #7825(avfilter:reopened): Malfunctioning `ssim` filter?.. (was: `-lavfi ssim` is not colorspace aware?..)

FFmpeg trac at avcodec.org
Tue Jan 28 19:38:04 EET 2020


#7825: Malfunctioning `ssim` filter?..
------------------------------------+------------------------------------
             Reporter:  gdgsdg123   |                    Owner:
                 Type:  defect      |                   Status:  reopened
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:  ssim        |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------
Changes (by gdgsdg123):

 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 I fear even the core of the [http://ffmpeg.org/ffmpeg-filters.html#ssim
 `ssim`] filter may not be functioning properly...
 [[BR]]
 [[BR]]
 I purposely made 2 PNG files of "sheer black" content
 ([http://trac.ffmpeg.org/raw-attachment/ticket/7825/black.png
 ""black.png""], [http://trac.ffmpeg.org/raw-
 attachment/ticket/7825/tainted.png ""tainted.png""]), with the
 "tainted.png" purposefully had the most upper-left pixel tainted to a
 different color, and:
 {{{
 ffmpeg -i "black.png" -i "tainted.png" -lavfi "ssim;[0][1]psnr" -f null -
 }}}
 {{{
 ffmpeg version git-2020-01-26-5e62100 Copyright (c) 2000-2020 the FFmpeg
 developers
   built with gcc 9.2.1 (GCC) 20200122
   configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-
 fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-
 libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
 --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr
 --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack
 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2
 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
 libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa
 --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx
 --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc
 --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
 --enable-amf
   libavutil      56. 38.100 / 56. 38.100
   libavcodec     58. 67.100 / 58. 67.100
   libavformat    58. 36.100 / 58. 36.100
   libavdevice    58.  9.103 / 58.  9.103
   libavfilter     7. 71.100 /  7. 71.100
   libswscale      5.  6.100 /  5.  6.100
   libswresample   3.  6.100 /  3.  6.100
   libpostproc    55.  6.100 / 55.  6.100
 Input #0, png_pipe, from 'black.png':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: png, rgb24(pc), 3840x2160, 25 tbr, 25 tbn, 25 tbc
 Input #1, png_pipe, from 'tainted.png':
   Duration: N/A, bitrate: N/A
     Stream #1:0: Video: png, rgb24(pc), 3840x2160, 25 tbr, 25 tbn, 25 tbc
 Stream mapping:
   Stream #0:0 (png) -> ssim:main
   Stream #0:0 (png) -> psnr:main
   Stream #1:0 (png) -> ssim:reference
   Stream #1:0 (png) -> psnr:reference
   ssim -> Stream #0:0 (wrapped_avframe)
   psnr -> Stream #0:1 (wrapped_avframe)
 Press [q] to stop, [?] for help
 Output #0, null, to 'pipe:':
   Metadata:
     encoder         : Lavf58.36.100
     Stream #0:0: Video: wrapped_avframe, gbrp(progressive), 3840x2160,
 q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.67.100 wrapped_avframe
     Stream #0:1: Video: wrapped_avframe, gbrp, 3840x2160, q=2-31, 200
 kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.67.100 wrapped_avframe
 frame=    1 fps=0.0 q=-0.0 Lq=-0.0 size=N/A time=00:00:00.04 bitrate=N/A
 speed=0.122x
 video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 [Parsed_ssim_0 @ 0000000002a16b40] SSIM R:1.000000 (inf) G:1.000000 (inf)
 B:1.000000 (inf) All:1.000000 (inf)
 [Parsed_psnr_1 @ 0000000002a1f2c0] PSNR r:117.318653 g:inf b:inf
 average:122.089866 min:122.089866 max:122.089866
 }}}
 ...You sure this fits the definition?
 [[BR]]
 >
 [https://en.wikipedia.org/wiki/Structural_similarity#Application_of_the_formula
 Structural similarity - Wikipedia]
 >
 > The resultant SSIM index is a decimal value between -1 and 1, and value
 '''1 is only reachable in the case of two identical sets of data''' and
 therefore indicates perfect structural similarity.
 [[BR]]
 [[BR]]
 [[BR]]
 Also check:
 > [https://www.texpion.com/2018/07/av1-vs-vp9-vs-avc-h264-vs-
 hevc-h265-1-lossless.html AV1 vs VP9 vs AVC (h.264) vs HEVC (h.265) Part I
 - Lossless]
 >
 > {{{
 > SSIM Y:1.000000 (73.043867) U:1.000000 (70.134668) V:1.000000
 (69.880162) All:1.000000 (72.541141)
 > PSNR y:97.786557 u:99.494677 v:99.335577 average:98.264431 min:79.206295
 max:inf
 > }}}
 [[BR]]
 > [https://video.stackexchange.com/a/17853 What does the value in
 parentheses for ffmpeg ssim log denote - Video Production Stack Exchange]
 >
 > It is dB representation of All value, calculated with following formula:
 > {{{
 > 10 * log10(1 / (1 - ssim))
 > }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7825#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list