基于ffmpeg不同编码方式转码后的psnr对比
一、测试说明:
源文件:1080psrc.mp4
时长:900秒
源文件信息:Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 2960 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
编解码方式:CPU软解
二、硬件环境
CPU:Intel(R) Xeon(R) Silver 4210 CPU @ 2.20GHz
MemTotal:263778192 kB 【256G】
服务器型号:浪潮5280M5
三、测试记录
1、medium编码方式
转码命令:
ffmpeg -i 1080psrc.mp4 -vcodec libx264 -b:v 2000k -preset medium -s 1920x1080 1080pdst_m.mp4
目标文件信息:
frame=21580 fps= 74 q=-1.0 Lsize= 258825kB time=00:15:00.01 bitrate=2355.9kbits/s speed=3.07x
video:220710kB audio:37518kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.230992%
输出psnr信息表:
ffmpeg -i e:/1080psrc.mp4 -i e:/1080pdst_m.mp4 -lavfi psnr="stats_file=psnr_m.log" -f null -
psnr数据结果:
[Parsed_psnr_0 @ 000001cccfd5ee80] PSNR y:47.426978 u:52.260537 v:51.759605 average:48.489974 min:37.617117 max:58.609825
2、faster编码方式
转码命令:
ffmpeg -i 1080psrc.mp4 -vcodec libx264 -b:v 2000k -preset faster -s 1920x1080 1080pdst_f.mp4
目标文件信息:
frame=21580 fps=104 q=-1.0 Lsize= 258949kB time=00:15:00.01 bitrate=2357.0kbits/s speed=4.33x
video:220835kB audio:37518kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.230628%
输出psnr信息表:
ffmpeg -i e:/1080psrc.mp4 -i e:/1080pdst_f.mp4 -lavfi psnr="stats_file=psnr_f.log" -f null -
psnr数据结果:
[Parsed_psnr_0 @ 0000019020af1140] PSNR y:47.290942 u:51.524273 v:51.000436 average:48.257391 min:37.380386 max:57.120105
3、slower编码方式
转码命令:
ffmpeg -i 1080psrc.mp4 -vcodec libx264 -b:v 2000k -preset slower -s 1920x1080 1080pdst_l.mp4
目标文件信息:
frame=21580 fps= 36 q=-1.0 Lsize= 258589kB time=00:15:00.01 bitrate=2353.7kbits/s speed=1.51x
video:220475kB audio:37518kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.231152%
输出psnr信息表:
ffmpeg -i e:/1080psrc.mp4 -i e:/1080pdst_l.mp4 -lavfi psnr="stats_file=psnr_l.log" -f null -
psnr数据结果:
[Parsed_psnr_0 @ 000001a2cb391c80] PSNR y:47.778224 u:52.780825 v:52.265745 average:48.864826 min:37.681372 max:58.451310
4、文件转码前后大小对比
序号 | 文件名 | 文件大小KB |
1 | 1080psrc.mp4 | 352,597 |
2 | 1080pdst_m.mp4 | 258,825 |
3 | 1080pdst_f.mp4 | 258,950 |
4 | 1080pdst_l.mp4 | 258,590 |