既存のpsnrフィルタを拡張して、視覚的品質に対する評価に重きを置いた7.1以降から使える予定のxpsnrフィルタの使い方。従来のpsnr評価と同様の範囲で比較する動画は同じ解像度とfps、ピクセルフォーマットである必要がある。

参照できる論文。

  • C. R. Helmrich, M. Siekmann, S. Becker, S. Bosse, D. Marpe, and T. Wiegand, “XPSNR: A Low-Complexity Extension of the Perceptually Weighted Peak Signal-to-Noise Ratio for High-Resolution Video Quality Assessment,” in Proc. IEEE Int. Conf. Acoustics, Speech, Sig. Process. (ICASSP), virt./online, May 2020. http://www.ecodis.de/xpsnr.htm
  • C. R. Helmrich, S. Bosse, H. Schwarz, D. Marpe, and T. Wiegand, “A Study of the Extended Perceptually Weighted Peak Signal-to-Noise Ratio (XPSNR) for Video Compression with Different Resolutions and Bit Depths,” ITU Journal: ICT Discoveries, vol. 3, no. 1, pp. 65 – 72, May 2020. https://www.itu.int/pub/S-JOURNAL-ICTS.V3I1-2020-8

2つの映像の画質評価をする psnr

基本コマンド

最終結果だけを表示。1入力がオリジナルの動画で、2入力がXPSNRを計算する動画で、他の評価フィルタの順番とは逆になっている。
ffmpeg -i input1 -i input2 -filter_complex xpsnr -an -f null -

The filter requires two input videos. The first input is considered a (usually not distorted) reference source and is passed unchanged to the output, whereas the second input is a (distorted) test signal.

1入力と2入力の解像度が異なるときはscaleフィルタで揃えられる。
ffmpeg -i input1 -i input2 -filter_complex [1:v][0:v]scale=rw:rh:flags=bicubic[1v];[0:v][1v]xpsnr -an -f null -
ffmpeg -i input2 -i input1 -filter_complex scale=rw:rh:flags=bicubic[0v];[1:v][0v]xpsnr -an -f null -

動画の短い時間の方で終了するにはeof_action=1:shortest=1:repeatlast=0を追加する。
ffmpeg -i input1 -i input2 -filter_complex [1:v][0:v]scale=rw:rh:flags=bicubic[1v];[0:v][1v]xpsnr=eof_action=1:shortest=1:repeatlast=0 -an -f null -

ffprobeで調べる。順番無指定だとuyv、grbになる。
ffprobe -v error -f lavfi -i movie=orig.mp4[0v];movie=enc.mp4[1v];[0v][1v]xpsnr=eof_action=1:shortest=1:repeatlast=0 -select_streams v:0 -show_entries frame=pts_time,pkt_pts_time:frame_tags -of csv=p=0 > xpsnr.csv
ffprobe -v error -f lavfi -i movie=orig.mp4[0v];movie=enc.mp4[1v];[0v][1v]xpsnr=eof_action=1:shortest=1:repeatlast=0 -show_entries packet=pts_time -show_entries packet_tags=lavfi.xpsnr.xpsnr.y,lavfi.xpsnr.xpsnr.u,lavfi.xpsnr.xpsnr.v -of csv=p=0 > xpsnr.csv

ffprobe の使い方

公式ドキュメント:FFmpeg Filters Documentation : xpsnr

オプション

  • stats_file, f[string]
    ログファイルの出力名。小数点以下は4桁まで書き込む。で標準出力する

ログファイルの見方

  • n
    フレーム番号
  • XPSNR y, XPSNR u, XPSNR v, XPSNR r, XPSNR g, XPSNR b
    個別のチャンネルのxpsnr

扱えるメタデータ。

lavfi.xpsnr.xpsnr.y
lavfi.xpsnr.xpsnr.u
lavfi.xpsnr.xpsnr.v
lavfi.xpsnr.xpsnr.r
lavfi.xpsnr.xpsnr.g
lavfi.xpsnr.xpsnr.b

評価方法

http://www.jiima.or.jp/pdf/5_JIIMA_guideline.pdf より

PSNR SSIM 主観評価
40~∞[dB] 0.98以上 元の画像と圧縮画像の区別がつかない
30~40[dB] 0.90~0.98 拡大すれば劣化がわかるレベル
30以下[dB] 0.90以下 明らかに劣化がわかる

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)