Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th April 2024, 19:36   #1  |  Link
MaxLt
Registered User
 
Join Date: Feb 2016
Posts: 9
Struggle with low-contrast video compression

I ran into an odd issue with videos I need to compress.

The video is of gymnasts performing, and the issue is particularly with floor routines. It's a 4K 60 FPS HLG HDR video with an unimportant mostly flat background (beige carpet) but a very important human quickly moving in random directions. The videos are for coaching and judging, so they are different from the broadcast style - no motion blur (shutter 1/200 or faster), and more zoomed out to show the position on the carpet better. There is low noise and no grain.

In compression, the priority is entirely on the gymnast, and it's important to be able to see fine details, like toe and hand positions and even facial expressions (judges want them to smile, no matter how gruelling the stuff they do is).

Compressing it straight with default x265 settings and CRF 19 (for example) crushes the video into ridiculously low 7-9mbit with much of the details being just blurred, especially high-motion parts. My guess is that much of the frame being flat carpet, the low contrast between carpet and gymnast, and the gymnast being a small part of the frame fool the compression algo into treating it as a low-complexity scene.

Lowering CRF helps very little with this problem (it seems most of the extra bits go not to gymnast but elsewhere) and also makes zoomed-in scenes shoot through the roof (>150Mbit, and I'm trying to keep it under 100mbit). I tried no-sao, and it helped a bit but also added some (small) artifacts around quick-moving limbs and on faces.

I guess I need to "tell" hevc to pay more attention and give more bits to that small, low-contrast, quick-moving object on a very flat and static background.

Any ideas?

Last edited by MaxLt; 10th April 2024 at 19:39.
MaxLt is offline   Reply With Quote
Old 10th April 2024, 23:47   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by MaxLt View Post
I ran into an odd issue with videos I need to compress.

The video is of gymnasts performing, and the issue is particularly with floor routines. It's a 4K 60 FPS HLG HDR video with an unimportant mostly flat background (beige carpet) but a very important human quickly moving in random directions. The videos are for coaching and judging, so they are different from the broadcast style - no motion blur (shutter 1/200 or faster), and more zoomed out to show the position on the carpet better. There is low noise and no grain.

In compression, the priority is entirely on the gymnast, and it's important to be able to see fine details, like toe and hand positions and even facial expressions (judges want them to smile, no matter how gruelling the stuff they do is).

Compressing it straight with default x265 settings and CRF 19 (for example) crushes the video into ridiculously low 7-9mbit with much of the details being just blurred, especially high-motion parts. My guess is that much of the frame being flat carpet, the low contrast between carpet and gymnast, and the gymnast being a small part of the frame fool the compression algo into treating it as a low-complexity scene.

Lowering CRF helps very little with this problem (it seems most of the extra bits go not to gymnast but elsewhere) and also makes zoomed-in scenes shoot through the roof (>150Mbit, and I'm trying to keep it under 100mbit). I tried no-sao, and it helped a bit but also added some (small) artifacts around quick-moving limbs and on faces.

I guess I need to "tell" hevc to pay more attention and give more bits to that small, low-contrast, quick-moving object on a very flat and static background.

Any ideas?
Can you share your command line? Maybe a screen shot of a typical frame?

To raise detail in some areas without raising bitrate a lot, you'll want to play with --aq-mode and --aq-strength.

If there is some noise in the source, some --nr-inter can help save bits by reducing that.

In general, going to --preset slower from the detail will give you lower bitrates at the same quality. Your very high peak bitrates suggests you're not setting --profile and --level, or --vbv-maxrate and --vbv-bufsize.

If this was a big problem with a budget behind it, I'd come up with a ML-based gymnast detector to define regions of visual saliency, and then differently compress those regions less than the rest of the frame. Or at least blur them a bit to make them easier to compress.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 12th April 2024, 16:53   #3  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,599
Limiting QPmax should help as well. It may be helpful to upload a sample.
I would like to tickle any encoder a bit to spend bits in dark and guessed-flat areas because such scenario comes around more often.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Old 12th April 2024, 20:18   #4  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Location: Berlin, Germany
Posts: 376
Have you tried --no-cutree and --tune psnr yet ?
rwill is offline   Reply With Quote
Old 12th April 2024, 21:12   #5  |  Link
MaxLt
Registered User
 
Join Date: Feb 2016
Posts: 9
The command line I got the best results from so far is

f:\ffmpeg\bin\ffmpeg -hwaccel cuda -i %%a -c:v libx265 -preset slower -crf 19 -color_primaries bt2020 -colorspace bt2020nc -x265-params "deblock=-2,-2:high-tier=1:aq-mode=2:frame-threads=0:no-sao=1sy-rdoq=2.00:subme=7:merange=64

Going from "slow" to "slower" did improve things noticeably.

I have difficulty with attaching a screenshot. I'll try to figure it out later.
MaxLt is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:03.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.