Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First One Second Of VVC Encoding Is Lower Quality? #322

Closed
JohnTravolski opened this issue Sep 26, 2023 · 4 comments
Closed

First One Second Of VVC Encoding Is Lower Quality? #322

JohnTravolski opened this issue Sep 26, 2023 · 4 comments
Labels
library Concerns the VVenC library question Further information is requested

Comments

@JohnTravolski
Copy link

JohnTravolski commented Sep 26, 2023

I have been testing vvc/libvvenc in ffmpeg as a long term archival format. I have been using this build:

(release-6.0n-patch6, using this build https://www.chosenfewsoftware.com/projects/ffmpeg-vvc/)

I have been using ffmetrics to plot the PSNR and SSIM values of the encoded file compared to the lossless original file over time (these video files are rendered 3D animations [8 bits per channel, RGB], so the source is a PNG sequence and is truly lossless). The command I have been using to encode is the following:

ffmpeg -i "{input}" -y -c:v libvvenc -preset medium -vvenc-params bitrate=320M "{output}"

I noticed there there is always a big jump in the PSNR or SSIM values around the one second mark of the video. Here are examples for two different videos:

image

image

The green line is vvc, with prores (red) and libx265 (yellow) codecs as a comparison. Notice how around the 60th frame, there is a big jump in the PSNR value for vvc (the content is 60fps). The SSIM value does the same thing.

Is this expected behavior? Why does this happen? Is there a parameter to prevent this and keep the quality more consistent between frames?

@adamjw24
Copy link
Member

adamjw24 commented Sep 28, 2023

Hi there,

it looks like you are running VVenC in rate control mode. What you seeing is a tune-in behavior. At such super high rates (is this UHD? if so, computer generated animation should not require more than 50mbps for great quality) our QP estimation undershoots a bit apparently. It is intended, since it is much easier to compensate up than down (the latter leads to heavy artifacts). Also, does it really matter if your PSNR is 50 instead of 53 for a second? Both are visually lossless for 8 bit content. After one second rate control adapts and keeps the quality throughout the rest of the encoding (my guess is that the produced file is still well below 320mbps).

So why does this not happen to x265? If I understand correctly, you are running it CRF mode, which basically is constant QP +-perceptual adaptations. Thats why they are not doing QP corrections, because the encoding doesn't have target rate set. You could do similar configuration with VVenC by setting target QP rather than rate (something around 10? you'd have to give it a try).

Last but not least, it looks like you are using a key-frame distance of 4 seconds for x265, did you align that for VVenC? If I were to guess from the plots, you left it at default 1 second.

@adamjw24 adamjw24 added question Further information is requested library Concerns the VVenC library labels Sep 28, 2023
@JohnTravolski
Copy link
Author

@adamjw24 , thanks, this is helpful.

  • This is 4K 60fps content.
  • Some animations are much more intricate and detailed than others, so I used a very high bitrate as a catchall since I'm intending to use this as an archival format for thousands of animations.
  • Yes, I was using CRF mode for libx265. I will try your suggestion for vvenc.
  • I am not sure what the key-frame distance is in the ffmpeg patch I used, but it is unchanged from default, as should be clear given it is not specified in the command I used.

@JohnTravolski
Copy link
Author

Interesting. Using a new build of ffmpeg with the latest patches, I no longer observe this behavior.

@adamjw24
Copy link
Member

adamjw24 commented Nov 7, 2023

Glad to hear, RC is being worked on very heavily atm. I'm closing for now.

@adamjw24 adamjw24 closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library Concerns the VVenC library question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants