2016-01-21 73 views
0

計算PSNR我有一個我想與ffmpeg的比較來計算的PSNRffmpeg的:對RGB三個通道

的ffmpeg自動計算PSNR上YUV渠道,而不是RGB 2張rgb48le TIF圖片。 這是我使用 「的ffmpeg-20160119-混帳cc83177-Win64的靜態」 的命令:

ffmpeg -y -an -i image1.tif -i image2.tif -filter_complex "psnr" output.tif 

,這是輸出:

[tiff_pipe @ 045b36a0] Stream #0: not enough frames to estimate rate; consider increasing probesize 
Input #0, tiff_pipe, from 'image1.tif': 
    Duration: N/A, bitrate: N/A 
Stream #0:0: Video: tiff, rgb48le, 7680x4320 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc 
[tiff_pipe @ 045c53a0] Stream #0: not enough frames to estimate rate; consider increasing probesize 
Input #1, tiff_pipe, from 'image2.tif': 
    Duration: N/A, bitrate: N/A 
    Stream #1:0: Video: tiff, rgb48le, 7680x4320 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc 
Output #0, image2, to 'output.tif': 
    Metadata: 
encoder   : Lavf56.40.101 
Stream #0:0: Video: tiff, rgb48le, 7680x4320 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default) 
Metadata: 
    encoder   : Lavc56.60.100 tiff 
Stream mapping: 
    Stream #0:0 (tiff) -> psnr:main 
    Stream #1:0 (tiff) -> psnr:reference 
    psnr -> Stream #0:0 (tiff) 
Press [q] to stop, [?] for help 
frame= 1 fps=0.3 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A 
video:195568kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 
[Parsed_psnr_0 @ 045cf760] PSNR y:46.00 u:49.32 v:50.34 average:48.14 min:48.14 max:48.14 

這是正常的嗎? 有沒有辦法強制PSNR在RGB48每個通道上計算?

+0

嘗試將兩個圖像轉換爲像素格式GBRP16LE或BE – Mulvya

回答

2

vf_psnr.c不支持rgb48,所以你需要轉換爲一些支持的格式。最簡單的(無損)轉換可能是gbrp16;這基本上是相同的像素數據,只是平面而不是打包(即GGGG [..] BBBB [..] RRRR [..]而不是RGBRGBRGBRGB [..])。

不幸的是,libswscale only supports output(在GBRP)高達14bpp,16bpp的沒有,所以你需要轉換爲gbr14p直到固定:

ffmpeg -i image1.tif -i image2.tif \ 
    -lavfi '[0:v]format=gbrp14[o1];[1:v]format=gbrp14[o2];[o1][o2]psnr' \ 
    -f null -nostats - 

這實際上做的PSNR在14bpp RGB。輸出仍然聲稱YUV,因爲drawutils.c,它不承認GBRP14實際上是RGB的錯誤。我會爲此提交一個patch。所以即使控制檯上的輸出顯示'y','u','v',通道順序實際上是'g','b','r'。

+0

謝謝!你的意思是,即使沒有旅行補丁,它會顯示RGB,但標籤爲yuv,或者我需要你的補丁來查看RGB通道的值? – Michele

+0

正確,沒有修補程序,它將顯示RGB但帶有YUV標籤。該補丁只是修復了標籤。 –