rigaya / QSVEnc

QSVによる高速エンコードの性能実験
http://rigaya34589.blog135.fc2.com/blog-category-10.html
Other
313 stars 28 forks source link

[REQ] MaxCLL & MaxFALL #131

Closed SiV44 closed 1 year ago

SiV44 commented 1 year ago

Hello @rigaya, Is it possible to add an option or a tool to calculate MaxCLL and MaxFALL values?

Thanks for your time Regards

rigaya commented 1 year ago

I'm not aware of "calculation" of MaxCLL and MaxFALL, so I cannot say if it is possible or not. I think QSVEnc can copy or set MaxCLL and MaxFALL already.

Would you please let me know the details of the idea?

SiV44 commented 1 year ago

I think QSVEnc can copy or set MaxCLL and MaxFALL already.

QSVEnc / NVEnc is able to copy / set these values, but there are cases where these values are missing.

Would you please let me know the details of the idea?

  • What will be the input data?
  • The details of the calculation process (How will it be calculated, what kind of formula is it used)?

Specifically, I'm talking about recording gameplay on next-gen consoles, which allows to keep the correct color metadata for HDR10 in the container but without the MaxCLL / MaxFALL values (Master Display and Chroma location are also missing, but that's not the point), I did some research and found an AviSynth plugin that is able to "calculate" / analyze these values as well as a forum thread that died a while ago.

Thread AVS Plugin Input Sample

I'm not a programmer, so most of what I've read is "dark magic" to me. And I understand that such "calculations" should be made on raw material.

From the perspective of how many tools you have added - Tweaks, Colorspace conversion with LUT3D, Color curves - such a tool could be an interesting / useful? addition.

Thanks for your time, Ragards

rigaya commented 1 year ago

Thank you for the information.

I've looked through the thread and the code, it seems like it needs to look throuhgt the video once, and then calculate the values for MaxCLL/MaxFALL, and finally encode again.

I think it's not suitable to add an option to QSVEnc application for this algorithm, as it is completely a pre-encode process.

SiV44 commented 1 year ago

I've looked through the thread and the code, it seems like it needs to look throuhgt the video once, and then calculate the >values for MaxCLL/MaxFALL, and finally encode again.

I think it's not suitable to add an option to QSVEnc application for this algorithm, as it is completely a pre-encode process.

Thanks for your reply and sorry for the very late response.

Hypothetically, the speed of MaxCLL/MaxFALL analysis is equal to the speed of the encoding process, the process saves the result in an external file (for example "MaxCLL.txt") after completion and the program is able to read / copy this result.

Would it be possible to create an option similar to coding in 2 passes? or just encoding in 2 passes?

In which the first pass would analyze the values and write them, while the second pass would read / copy these values and then encode.

1-pass: Input -> Analyze -> write MaxCLL/MaxFALL
2-pass: Input -> read MaxCLL/MaxFALL -> encode -> Output

Question about QSVEnc and NVEnc.

Thanks for your time.

rigaya commented 1 year ago

Actually, considering the role of the encoder, first pass analysis is not a role of the encoder. Therefore, it is not sutiable to add this into the encoder.

We should think of using what is already there first, rather than to re-implement something new. We can simply use the avs plugin that already exists.

The process can be completely automated by a simple script. I have created a example of the python script calc_maxcll.zip.


calc_maxcll.py

calc_maxcll.py will run following process automatically.

  1. Analyze MaxCLL/MaxFALL using MaxCLLFind. 1-1. Create avs file. 1-2. Run analysis using avs2pipemod. 1-3. Read MaxCLL/MaxFALL from analysis result file by script.
  2. Run encoder using calculated MaxCLL/MaxFALL.

How to use

SiV44 commented 1 year ago

Awesome, I'll check it out for sure.

Thanks for your time, work and patience. Best regards.