AV1 vs VP9 vs AVC (h.264) vs HEVC (h.265): Part I - Lossless
Conclusion
- In terms of lossless compression, x264 and x265 took less time and produced smaller files. All video codecs produced smaller video files than LZMA/LZMA2, the general purpose compression algorithms.
- In our tests, AV1 takes approximately 160-190x more time than x264 to encode in their lossless mode. AV1 does have a lossless mode, but the output is not lossless at all.
- VP9 and AV1 can take advantage of multi-threading, but they can not load all CPU cores all the time as x264 and x265 do.
Note
- At of June 2018, AV1 is still experimental.
- We used x264 as the AVC encoder.
- We used x265 as the HEVC encoder.
- We used pxz as the LZMA/LZMA2 compressor. LZMA is also the default algorithm of 7-Zip.
- The AV1 encoder ran with "--cpu-used=4" for "medium" speed, "--tile-columns=4" to enabling multi-threading. All encoders ran in their lossless mode, all other settings were as default.
Test 1
Source video
sintel_trailer_2k_480p24.y4m
© copyright Blender Foundation | durian.blender.org.
downloaded from https://xiph-media.net/
Results
File size | vs source | Real time | vs x264 | CPU time | vs x264 | |
---|---|---|---|---|---|---|
source | 770,452,201 | 100% | / | / | / | / |
x264 | 64,472,680 | 8.37% | 8.952s | 1:1 | 31.355s | 1:1 |
x265 | 73,248,027 | 9.51% | 45.912s | 5.13:1 | 2m40.161s | 5.11:1 |
VP9 | 81,054,127 | 10.52% | 1m51.466s | 12.45:1 | 3m19.448s | 6.36:1 |
AV1[1] | 89,369,111 | 11.60% | 24m34.523s | 164.71:1 | 70m58.562s | 135.82:1 |
pxz | 96,012,992 | 12.46% | 1m26.648s | 9.68:1 | 4m04.300s | 7.79:1 |
- Though encoded in the lossless mode, the result of AV1 is not lossless. If it is lossless, PSNR should be "inf" (infinity).
Encoding using only single thread gives better quality but the result is still not 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
Test 2
Source video
First 1000 frames of big_buck_bunny_360p24.y4m
(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org.
downloaded from https://xiph-media.net/
Results
File size | vs source | Real time | vs x264 | CPU time | vs x264 | |
---|---|---|---|---|---|---|
source | 345,606,058 | 100% | / | / | / | / |
x264 | 78,792,519 | 22.80% | 5.988s | 1:1 | 21.682s | 1:1 |
x265 | 70,727,042 | 20.46% | 36.840s | 6.15:1 | 1m59.747s | 5.52:1 |
VP9 | 85,613,755 | 24.77% | 1m15.534s | 12.61:1 | 2m20.185s | 6.47:1 |
AV1[1] | 118,300,962 | 34.23% | 19m21.654s | 194.00:1 | 60m12.302s | 166.60:1 |
pxz | 124,903,768 | 36.14% | 1m05.077s | 10.87:1 | 3m13.756s | 8.94:1 |
- Though encoded in the lossless mode, the result of AV1 is not lossless. If it is lossless, PSNR should be "inf" (infinity).
Encoding using only single thread gives better quality but the result is still not lossless.SSIM Y:1.000000 (68.378644) U:1.000000 (68.364410) V:1.000000 (67.624717) All:1.000000 (68.654537) PSNR y:95.817232 u:97.454878 v:97.277848 average:96.274602 min:77.131648 max:inf
Commands
Encode
AV1: aomenc --lossless=1 --cpu-used=4 --tile-columns=4 --webm -o output source
ffmpeg -i av1.webm -c copy av1.mkv # Time of this part wasn't counted.
VP9: ffmpeg -i source -c:v libvpx-vp9 -lossless 1 output.mkv
x264: ffmpeg -i source -c:v libx264 -qp 0 output.mkv
x265: ffmpeg -i source -c:v libx265 -x265-params lossless=1 output.mkv
lzma: pxz -k source
Get the first 1000 frames:
ffmpeg -i source -vframes 1000 -f yuv4mpegpipe output
Calculate PSNR and SSIM
ffmpeg -i encoded-video -f yuv4mpegpipe output
ffmpeg -i output -i source -lavfi "ssim;[0:v][1:v]psnr" -f null -
Codec version
AV1: aomenc 1.0.0-21-g96ee0eb45, source files downloaded from https://aomedia.googlesource.com/aom, Jun 28 2018
VP9: LAVC (h264)58.20.104 libvpx-vp9, source files downloaded from https://chromium.googlesource.com/webm/libvpx.git, Jun 28 2018
x264: core 155, source files downloaded from http://git.videolan.org/git/x264, Jun 28 2018
x265: 2.8+24-289b8a3730ae:[Linux][GCC 8.0.1][64 bit] 8bit, source file downloaded from https://bitbucket.org/multicoreware/x265, Jun 28 2018
ffmpeg: N-91378-g3f95337, source files downloaded from https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2, Jun 28 2018
LZMA: Parallel PXZ 4.999.9beta (build 20180209), Fedora 28
liblzma: 5.2.3, Fedora 28
Environment
- OS: GNU/Linux (Fedora 28)
- CPU: Intel Core i5 @ 4.0GHz
If you try adding `-preset veryfast` to your x264 lossless command you a big speedup with only a small penalty in size.
ReplyDelete