gpt4 book ai didi

ffmpeg - 为什么 FFMPEG SSIM 会根据这些未压缩视频中的哪个先/后产生不同的比较结果?

转载 作者:行者123 更新时间:2023-12-04 22:59:23 26 4
gpt4 key购买 nike

ffmpeg 的 ssim 说明说引用应该排在第二位,当我按顺序比较这些视频时,(其中“copy.avi”应该是“original.avi”的无损 H.264 副本)SSIM 和 PSNR 返回无损结果。但如果我颠倒顺序,性能就不是无损的。

为什么会这样?

先复制,后原创

> ffmpeg -hide_banner -i copy.avi -i original.avi -lavfi "ssim;[0:v][1:v]psnr" -f null –


[avi @ 0x7ffdee002000] decoding for stream 0 failed
Input #0, avi, from 'copy.avi':
Metadata:
encoder : Lavf58.20.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 644937 kb/s
Stream #0:0: Video: h264 (High 4:4:4 Predictive) (H264 / 0x34363248), yuv420p(progressive), 2048x1536, 645930 kb/s, 60 fps, 60 tbr, 60 tbn, 120 tbc
Input #1, avi, from 'original.avi':
Metadata:
encoder : Lavf54.35.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 1509965 kb/s
Stream #1:0: Video: rawvideo (Y800 / 0x30303859), gray, 2048x1536, 1512312 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 (h264) -> ssim:main
Stream #0:0 (h264) -> psnr:main
Stream #1:0 (rawvideo) -> ssim:reference
Stream #1:0 (rawvideo) -> psnr:reference
ssim -> Stream #0:0 (wrapped_avframe)
psnr -> Stream #0:1 (wrapped_avframe)
Press [q] to stop, [?] for help
Output #0, null, to '–':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: wrapped_avframe, yuv420p(progressive), 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
Stream #0:1: Video: wrapped_avframe, yuv420p, 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
frame= 640 fps= 72 q=-0.0 Lq=-0.0 size=N/A time=00:00:10.66 bitrate=N/A speed=1.21x
video:670kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_ssim_0 @ 0x7ffdef8024c0] SSIM Y:1.000000 (inf) U:1.000000 (inf) V:1.000000 (inf) All:1.000000 (inf)
[Parsed_psnr_1 @ 0x7ffdef802940] PSNR y:inf u:inf v:inf average:inf min:inf max:inf

先原创,后复制
> ffmpeg -hide_banner -i original.avi -i copy.avi -lavfi "ssim;[0:v][1:v]psnr" -f null –


Input #0, avi, from 'original.avi':
Metadata:
encoder : Lavf54.35.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 1509965 kb/s
Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 2048x1536, 1512312 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
[avi @ 0x7fb74680d600] decoding for stream 0 failed
Input #1, avi, from 'copy.avi':
Metadata:
encoder : Lavf58.20.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 644937 kb/s
Stream #1:0: Video: h264 (High 4:4:4 Predictive) (H264 / 0x34363248), yuv420p(progressive), 2048x1536, 645930 kb/s, 60 fps, 60 tbr, 60 tbn, 120 tbc
Stream mapping:
Stream #0:0 (rawvideo) -> ssim:main
Stream #0:0 (rawvideo) -> psnr:main
Stream #1:0 (h264) -> ssim:reference
Stream #1:0 (h264) -> psnr:reference
ssim -> Stream #0:0 (wrapped_avframe)
psnr -> Stream #0:1 (wrapped_avframe)
Press [q] to stop, [?] for help
Output #0, null, to '–':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: wrapped_avframe, gray(progressive), 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
Stream #0:1: Video: wrapped_avframe, gray, 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
frame= 640 fps= 72 q=-0.0 Lq=-0.0 size=N/A time=00:00:10.66 bitrate=N/A speed=1.19x
video:670kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_ssim_0 @ 0x7fb748101780] SSIM Y:0.998296 (27.684975) All:0.998296 (27.684975)
[Parsed_psnr_1 @ 0x7fb748101c40] PSNR y:56.840774 average:56.840774 min:56.812125 max:56.871584

最佳答案

一种格式是 yuv420p,另一种是灰色。因此,为了比较它们,要么将灰色转换为 yuv420p,要么将 yuv420p 转换为灰色。正如您所注意到的,此操作并不总是无损的。要仅比较 Y 平面,请在调用 psnr/ssim 之前使用 extractplanes=y 过滤器。

关于ffmpeg - 为什么 FFMPEG SSIM 会根据这些未压缩视频中的哪个先/后产生不同的比较结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53253504/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com