H.264 - X264/x265 Options For Fast Decoding While Preserving Quality
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs x264/x265 options for fast decoding while preserving quality Ask Question Asked 3 years, 2 months ago Modified 4 months ago Viewed 5k times 4I 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
Share Improve this question Follow edited Oct 29, 2021 at 11:30 user3301993 asked Oct 28, 2021 at 14:22 user3301993user3301993 731 silver badge5 bronze badges 1- By "fast decoding speed" do you mean low latency? or do you mean low cpu consumption on the decoding machine? By "quality" do you mean high resolution? high frame rate? lack of artifacts? What kind of material are you handling? Talking heads? Action-adventure movies with lots of explosions? Please edit your question to explain what you mean more completely. – O. Jones Commented Oct 28, 2021 at 18:09
3 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1As @O.Jones illuded to "it depends" is the best answer you're going to get. As the author of Compressarr, I can tell you figuring the answer to that question, per video, takes hours.
Basically, encode the video (using best guess values), check it for SSIM against the original. Decide what percentage of similarity is acceptable. (Above 98% is supposed to be an imperceivable difference) Check your file size and repeat with new options as necessary. You can get away with using samples, so you don't have to do the whole thing, but then the final SSIM is only a guess.
Or just use Compressarr and let it automate all that for you. :D
Share Improve this answer Follow answered Nov 15, 2021 at 16:29 TodTod 2,50629 silver badges33 bronze badges 1- Thank you @Tod. I taught that, since -tune fastdecode option exists and is is an alias for 4 or 5 other "sub" options. I wanted to pick the "sub" options that are guaranteed to be "lossless". But I guess my question seems to not make sens ^ ^ (maybe encoding options can't be categorized as simply as lossy vs lossless) My understanding of how encoding works is very limited. Thank you for suggesting SSIM and Compressarr, they will be of great help. – user3301993 Commented Nov 16, 2021 at 19:26
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.
Share Improve this answer Follow edited Sep 25, 2023 at 23:19 answered Sep 25, 2023 at 23:11 KJ7LNWKJ7LNW 1,8819 silver badges18 bronze badges Add a comment | 0Note: OBS only settings
Here are my recommendations for you:
Use veryfast CPU usage preset
Use x264
Use 15 CRF
Use VBR instead of CBR to reduce file size
Use 2500 Kbps Bitrate
Use Hybrid or Fragmented MP4 instead of plain MP4
Share Improve this answer Follow answered Aug 18 at 10:00 KiamehrPropyKiamehrPropy 11 bronze badge Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- The ghost jobs haunting your career search
- Breaking up is hard to do: Chunking in RAG applications
- Featured on Meta
- The December 2024 Community Asks Sprint has been moved to March 2025 (and...
- Stack Overflow Jobs is expanding to more countries
Related
17 Free/Open h.264 video decoding libraries? (Non-GPL) 0 Any open source, fast H263 decoder library for ARM9 than ffmpeg? 11 H264 Encoders other than ffmpeg x264 12 fast encoding video codec? 6 Recommendation on the best quality/performance H264 encoder for video encoding? 14 Encoding for fastest decoding with ffmpeg 7 How to choose between openH264 and x264 decoder 0 What codec/format to use for fastest possible decoding? 1 How to implement fast encoding with ffmpeg? 3 FFmpeg best LGPL alternative to libx264?Hot Network Questions
- Why there is an undercut on the standoff and how it affects its strength?
- Spotify's repository for Debian has outdated keys
- White fungus at the tree base leading to leaf loss
- Obtaining the absolute minimal, original TeX engine
- Bath Fan Roof Outlet Coupling
- Why was Jim Turner called Captain Flint?
- Can "Diese" sometimes be used as "she" in German sentences?
- Milky way from planet Earth
- Nonograms that require more than single-line logic
- What is the purpose of the philosophy of science?
- Did I accidentally delete files? How can I recover them?
- In The Good The Bad And The Ugly, why did Tuco call Clint Eastwood "Blondie?"
- Is it possible to prove that your criminal case in your country was illegal when obtaining a visa/permanent residency/citizenship?
- Should I use lyrical and sophisticated language in a letter to someone I knew long ago?
- Time Travel. Young Girl meets her older self - Who doesn't like her
- Is there precedent for a language that allows the "early return" pattern to go between function call boundaries?
- Nuclear fusion within a star and escape of light
- Would the discovery of sapient octopus on the coasts of Australia decrease or increase European interest on the continent?
- Sign of the sum of alternating triple binomial coefficient
- Latex code for tabular method of convolution
- TGV Transfer at Valence
- Why did they leave the Endurance outside the time dilation zone?
- Is online job converting crypto to cash a scam?
- Chromatic note and mode degrees
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Từ khóa » H264 X264 X265
-
A Large-Scale Comparison Of X264, X265, And Libvpx — A Sneak Peek
-
What Is The Difference Between X265 & X264 Video Coding ... - Quora
-
What's The Difference Between X264 And X265? - MacX DVD Ripper
-
HEVC (H.265) Vs. AVC (H.264): What's The Difference? - BoxCast
-
X265 - Wikipedia
-
H.264 Vs. H.265: Video Codecs Compared
-
What Is The Difference Between X264 And H264? - Huawei
-
H.264 Vs X264 And H.265 Vs X265 - VideoHelp Forum
-
X264 Vs X265 In 2021 : R/DataHoarder - Reddit
-
What Is The Difference Between H264 And H265? - Castr's Blog
-
H264 Vs H265 | Explained - YouTube
-
H.265 Nvenc | Ultrafast Medium Slower High Quality - YouTube
-
H.264 Vs. H.265: What They Are And Which One Is Better - Brid.TV
-
4 Reasons Why HEVC (H.265) Matters, And How You Can ... - Teradek