Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

x264/x265 options for fast decoding while preserving quality

I want to encode some videos in H264 and H265, and I would like to ask for help in order to chose the adequate options in x264/x265.

  • My first priority is video quality. Lossless would be the best quality for example
  • My second priority is fast decoding speed (ie: I would like faster decoding without sacrificing quality)
    • fast decoding for me means that the decoding machine would use less CPU resources reading the resulting video
    • Less RAM consumption would be a plus
    • Latency is not important
  • I don't care that much if the output file ends up bigger. Also, encoding speed is not important

I'm aware of the option -tune fastdecode in both x264 and x265. But apparently the quality gets a bit worse using it.

For x264:

-tune fastdecode is equivalent to --no-cabac --no-deblock --no-weightb --weightp 0 (My source is x264 --fullhelp)

Which options preserve quality ?

For x265:

-tune fastdecode is equivalent to --no-deblock --no-sao --no-weightp --no-weightb --no-b-intra (according to x265 doc)

Again, which options preserve quality ?

I tried to read some documentation on these options, but I'm afraid I'm too stupid to understand if they preserve quality or not.

To explain further what I mean by "preserving quality":

I don't understand what the cabac option does exactly. But let's say for example that it adds some extra lossless compression, resulting in a smaller video file, but the decoding machine would need to do extra work to decompress the file

In that case, the --no-cabac option would skip that extra compression, resulting in no loss of quality, with a bigger file size, and the decoding machine would not need to decompress the extra compression, saving CPU work on the decoding side

In this scenario, I would like to add the --no-cabac option, as it speeds up decoding, while preserving quality.

I hope I could get my point across

Can anyone help me pick the right options ?

Thanks in advance

like image 894
user3301993 Avatar asked Oct 17 '25 19:10

user3301993


1 Answers

For x264 (I've not looked at x265):

-tune fastdecode is equivalent to --no-cabac --no-deblock --no-weightb --weightp 0 (My source is x264 --fullhelp)

  • CABAC is lossless compression but provides ~15% file size reduction, so --no-cabac has no quality effect.
  • deblock affects quality: "Deblock work as a sort of filter that blurs out the edges of block artifacts, making the picture look cleaner."
  • weightb/weightp: These affect the P-frame generation, so quality will be affected, but you would have to compare to know what changed. It may not be a noticable difference.

In my case, I want --no-cabac but --no-weightb --weightp 0 effected quality and I still want deblocking. I think --no-cabac is the only lossless performance gain option.

like image 151
KJ7LNW Avatar answered Oct 22 '25 00:10

KJ7LNW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!