staxrip / staxrip

🎞 Video encoding GUI for Windows.
MIT License
2.15k stars 120 forks source link

Question/Request - Is there a way to force StaxRip to retain Template settings? #1431

Closed noblemd00 closed 2 hours ago

noblemd00 commented 1 month ago

v.2.41.7 NVEncC H265

Apparently, based on the original encoding, StaxRip arbitrarily changes user Template settings when loading source files - Can this be prevented?

i.e. VUI settings -Colormatrix, Colorprim, Transfer, and etc. are consistently changed.

If there is no option to prevent this from happening - request an option to force retention of template settings. Or, at least a notification and permission to change user set template options.

  1. The user should be able to set options to encode files as the user needs without them being changed.

  2. In order to play DolbyVision files on some TVs certain color settings must be used - StaxRip usually changes these user template settings forcing the user to manually reenter the setting(s) after source loading. Note: some files retain the proper settings.

i.e. Template VUI Transfer setting = BT 2020-12/10 or Undefined - After DolbyVision source load, VUI Transfer must be manually re-set to Undefined or BT 2020-10/12 for some TVs to recognize the video as a DolbyVision encode - StaxRip always changes a DolbyVision encode VUI Transfer to SMPTE 2084 which will not play as DolbyVision on some TVs.

3 And, cannot Batch process files with user required settings - settings are changed by StaxRip!

Dendraspis commented 1 month ago

A very long question/request for a very short answer: Project » Options » Video » Import VUI metadata 😁

Or as a picture:

The red marked settings are especially used to alter the template settings. Note, that the Dolby Vision metadata as well as the RPU file path are also set via Import VUI metadata. So in case your mentioned workflow you would need to add it by hand.

If there is no option to prevent this from happening

πŸ˜…

After DolbyVision source load, VUI Transfer must be manually re-set to Undefined or BT 2020-10/12 for some TVs to recognize the video as a DolbyVision encode

Which Dolby Vision profile is it?

noblemd00 commented 1 month ago

After DolbyVision source load, VUI Transfer must be manually re-set to Undefined or BT 2020-10/12 for some TVs to recognize the video as a DolbyVision encode

Which Dolby Vision profile is it?

Dolby Vision 8.1

noblemd00 commented 1 month ago

Thanks for the reply! - I've noticed that VUI Import setting several times but the purpose never clicked. Doh!

(unchecking fixes the Transfer = SMPTE 2084 problem)

Dendraspis commented 1 month ago

In 99.9% of all cases, the settings made by Import VUI metadata will get a working and proper result. I don't know why your TV should have any issues with it, but in general it is what you should use. The only exception should be Profile 5.

I've noticed that VUI Import setting several times but the purpose never clicked. Doh!

Happens sometimes. 😁

So I guess we can close this one?

noblemd00 commented 1 month ago

If Import VUI metadata is unchecked, Dolby Vision RPU and HDR file paths are not loaded in VUI Options requiring editing after source load (and preventing batch processing).

When loading Dolby Vision or HDR encoded files the RPU/Json file/path-name should be loaded even when Import VUI metadata is unchecked. OR, additional options should be available to choose what to load.

Dendraspis commented 1 month ago

If Import VUI metadata is unchecked, Dolby Vision RPU and HDR file paths are not loaded in VUI Options requiring editing after source load (and preventing batch processing).

Yes, that's what I already mentioned in my first post. πŸ˜…

Those files are part of VUI and I don't think I will change the behavior. For the paths you can use macros to point to those files, something like: %temp_dir%\HDRDVmetadata.rpu

noblemd00 commented 1 month ago

I've added an Event Command that seems to work...

My templates name (for files needing an RPU) contains either "DV" (Dolby Vision only) or "HDV" (DV+HDR) - the event command checks for "DV" in the template name then executes the command line --dolby-vision-rpu "%temp_dir%\HDRDVmetadata.rpu" if present.

Example Template names: Movie.4k.HDV.mp4.srip and MKV.to.MP4_MUX.DV.Video.Audio.srip

I also plan to create an Event Command to add the HDR10 info file automatically. Any suggestions for that would appreciated.

240723 101911
Dendraspis commented 1 month ago

It works, but: Why so complicated ????

Just use what I have mentioned above and you're fine:

...should also work great for HDR10+.

Dendraspis commented 1 month ago

Does it work? Can we close this now?

noblemd00 commented 1 month ago

No, does not work - does not load other needed settings (such as the Master Display entry).

Selected OPTION/VIDEO/Import VUI metadata (box checked) and...

I've changed the Event Command as below (to change Transfer to a proper setting - for me - still experimenting but it seems to work):

240726 093501
noblemd00 commented 1 month ago

Additional-

There should be a way (multiple CheckBoxes) to allow the user to prevent the program from changing individual template VUI settings other than the LOAD EVERYTHING or LOAD NOTHING choice.

And, with the added Dolby Vision and HDR(10+) capabilities there needs to be Event Command Options/Macros relating to Dolby Vision and HDR(10+) settings.

One other thing - Event Commands are still not working when Batch processing. (not sure if you addressed this problem earlier).

Dendraspis commented 1 month ago

To be fair: You are the first one with such an issue and I still don't understand why you have to do this....

Basically you use Import VUI metadata to transfer all related settings to the encoder and in general this is all you need and want. In your case you can overwrite some of those settings via events.

And, with the added Dolby Vision and HDR(10+) capabilities there needs to be Event Command Options/Macros relating to Dolby Vision and HDR(10+) settings.

ImportVideoEncoderCommandLine covers all parameters for the encoders. Sounds like you request taking two or more parameters out of it to make them settable directly, also handling issues when both are set or the different parameters across the encoders. I don't think this is the right way.... When it comes to macros I totally agree with you and I will implement them: %hdr10plus_path% and %hdrdv_path%. I guess the path is enough for every purpose.

One other thing - Event Commands are still not working when Batch processing. (not sure if you addressed this problem earlier).

I will have a look.... Which event(s) do you mean in particular?

noblemd00 commented 1 month ago

When it comes to macros I totally agree with you and I will implement them: %hdr10plus_path% and %hdrdv_path%. I guess the path is enough for every purpose.

Will that allow a differentiation between - Being able to select - HDR10PlusMetadata.json file if available or HDRDVmetadata_L5.json if not - i.e. How will StaxRip know that it has to use the HDRDVmetadata_L5.json file because the HDR10PlusMetadata.json file does not exist? And if neither exist process as Dolby Vision only (Profile 5 - this part not required but might be useful to some USERS ).

240729 143907 240729 145343
noblemd00 commented 1 month ago

One other thing while I'm asking questions -

It does not matter how I process Dolby Vision videos (different Options-Video-RPU Conversion Mode setting, different VUI Dolby Vision Profile setting, and slightly different Color Matrix etc. settings.

I always get finished files that MediaInfo reports: HDR format : Dolby Vision, Version 1.0, Profile 5, dvhe.05.06, BL+RPU, no metadata compression / SMPTE ST 2086 / SMPTE ST 2086

Always Profile 5

Am I doing something wrong - I've tried various settings.

noblemd00 commented 1 month ago

Batch file processing - This event inserts height in the Target name (1080p, 720p, or whatever) and inserts h265 in name- works for single processed file but NOT Batch processed files. I don't think any Events are working during Batch proc. Have not checked all.

Which event(s) do you mean in particular?

240729 194142
Dendraspis commented 1 month ago

The Command is not really interesting for me at the moment, I would like to know which Event it is that you have chosen in the upper right corner, so I can check exactly where it gets called.

Will that allow a differentiation between [..]

%hdr10plus_path% is for HDR10+ and %hdrdv_path% is for Dolby Vision files. Because you set them before encoding, StaxRip will process the paths as usual.

I always get finished files that MediaInfo reports [..]

Don't know if you take care, but you also have to set the right Dolby Vision Profile:

Profile 5 means, that your video can only be played on players, that can play Dolby Vision - there is no compatibility for HDR10. Therefore the default is Profile 8.1. Like I said, the default values result in a proper Profile 8.1 result: Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible

Maybe you should try a normal file processing and not a batch file encoding, just to make sure, that it is not Batch encoding itself or a wrong template or so.

noblemd00 commented 1 month ago

EDIT OK, now I have to change all below - I just downloaded the latest version of KODI and it now plays MKV Dolby Vision videos properly as well as playing Dolby Vision Profile 5 MKVs properly - Profile 5 used to require changing the container to MP4.

So, KODI video player now works properly to play Dolby Vision. I still have to check if Transfer = SMPTE 2084 plays properly, but I think it will since original downloaded MKVs now play Dolby Vision that this is fixed in KODI - excellent, as I prefer the KODI interface.

I think with this latest KODI upgrade all issues are fixed! No more re-encode changes required to play Dolby Vision in KODI.

So, multiple problems solved!

noblemd00 commented 1 month ago

NVEncC - H.265

FYI I just tried to load a Dolby Vision Profile 5 source file and the RPU path/file was not loaded into VUI (I think I reported this problem a long time ago).

And, no VUI parameters were loaded - All Undefined

Import VUI metadata was checked

noblemd00 commented 1 month ago

Another FYI: In order to properly re-encode Dolby Vision 8 / HDR10+ combo files

0: Parses RPU, rewrites it untouched

must be selected as the RPU Conversion Mode

MediaInfo with RPU Conversion Mode: 2: Convert RPU to be 8.1 compatible HDR format : Dolby Vision, Version 1.0, Profile 8, dvhe.08.06, BL+RPU, no metadata compression / SMPTE ST 2094 App 4

MediaInfo with RPU Conversion Mode: 0: Parses RPU, rewrites it untouched HDR format : Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile B compatible

Dendraspis commented 1 month ago

Okay, so this issue seems to be fixed thanks to an up to date KODI version. πŸ₯³ Glad we can at least close that chapter...

NVEncC - H.265

Can't confirm that, but it depends which meta dates the source file provides. Profile 5 sources often leak substantial HDR metadata , so the VUI Import is not called, which means that the metadata files are also not set. v2.42 will try to close the gap and set the metadata files regardless the other information.

In order to properly re-encode Dolby Vision 8 / HDR10+ combo files

At first place that depends on your source file and what you want your result to be. Dolby Vision wise both encodes should be the same. In your case you also seem to have HDR10+ metadata, which can make the difference. In that case it would be interesting to see the media info of the source file.

noblemd00 commented 1 month ago

Re: Another FYI (DV/HDR10+)

Additional settings (may be needed - haven't tested every option)

240730 202947

Yields (MediaInfo): Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile B compatible

Not sure if these can be altered, but this was gleaned from previous HDR10+ experiments and they worked whereas other settings did not.

noblemd00 commented 1 month ago

Original MediaInfo file from DV/HDR10+ A.Quiet.Place.Day.One.2024.HDV.mkv.MediaInfo.txt

Dendraspis commented 1 month ago

When both meta files are set basically there should be no difference, especially because the Dolby Vision part of the media info is the same, but I have to find such a sample file to verify that.

You can use the RPU Conversion Mode 0 for such cases as the default setting is just a default. If there is a significant difference, I might add an Automatic mode, but not sure about that.

Additional settings (may be needed - haven't tested every option)

Generally no VUI setting changes should be necessary as they are imported from the source. Changing them can interfere with playback compatibilities.

noblemd00 commented 1 month ago

I've refined the previous DV/HDR10+ VUI settings - testing several combinations - to get the proper HDR Format (per MediaInfo as below):

Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile B compatible

and get proper Dolby Vision playback while also getting the best HDR10+/HDR playback.

These settings seem to work best (RPU Conversion Mode 0):

240801 145708
Dendraspis commented 1 month ago

Looks exactly like intended, so the only difference seems to be the RPU Conversion Mode. πŸ€”

I will think about adding an Automatic mode to catch that case, but I don't think it's worth it, especially because both results should be the same, at least valid.

noblemd00 commented 1 month ago

This is the matrix I have come up with after much experimentation...

See updated matrix below

Note: DV+HLG re-encoded from DV/HDR(10+) videos (Transfer characteristics HLG/PQ). All yield proper MediaInfo HDR Format entries and proper HDR (HDR only TV) and Dolby Vision (DV-HDR TV) playback.

noblemd00 commented 1 month ago

Am I correct that the RPU Conversion Mode needs to be set before source load - In other words, the RPU conversion "converts" as the source file is loaded into StaxRip or does the RPU conversion take place during processing (during re-encode)?

I ask because this occurs during source load: 240804 101420

Dendraspis commented 1 month ago

Currently: yes.

I'm thinking about an automatic mode or adding a new mode for specific cases, but it's not that easy to take every aspect into account. For the moment it seems to be enough to add a new mode, that uses RPU conversion mode 2 generally, but mode 0 for DV Profile 5.

Dendraspis commented 1 month ago

Let's keep it open till I have found a solution...

noblemd00 commented 1 month ago

Minor update to the matrix re. re-encoding HDR10+ only videos - Depending on how the HDR10+ video was originally encoded, Try ATC SEI = UKNOWN first, and then try = "Auto" or "SMPTE 2084" check MediaInfo after re-encoded for proper configuration.

_  Re-encode VUI Parameters

(using StaxRip v.2.42.1) Updated per - DV+HLG uses Profile 8.4... and proper DV+HDR(10+) compatible playback on a HDR only (not DolbyVision) TV.

Tested 'Auto' for ATC SEI and the result was no HDR playback. Colorrange 'Full' resulted in the picture being to bright.

Dendraspis commented 4 weeks ago

Thanks for the overview, I will have a look and see what I can improve.

Btw: Did you already join the Discord server?

Dendraspis commented 3 weeks ago

I guess that means no. 😁

Just to make sure: DV+HLG uses Profile 8.4, so the conversion mode should be 4 instead of 2. Do you agree?

noblemd00 commented 2 days ago

Updated matrix (above) per suggestion - DV+HLG uses Profile 8.4...

noblemd00 commented 2 days ago

Question about the new macros %hdr10plus_path%, %hdrdv_path%

How can a determination be made (automatically) to use the proper HDRDVmetadata_L5.json, HDRDVmetadata_Config.json or HDR10PlusMetadata.json entry in the HDR10 info file inputbox?

Event Command: ImportVideoEncoderCommandLine (After Source Opened) Command Line = --dhdr10-info "%hdr10plus_path%"

If the video file is HDR10+ the entry is correct however if the file is DV/HDR or DV/HDR10 (not +) the entry is blank.

Dendraspis commented 2 days ago

Welcome back. 😁

How can a determination be made (automatically) to use the proper HDRDVmetadata_L5.json, HDRDVmetadata_Config.json or HDR10PlusMetadata.json entry in the HDR10 info file inputbox?

The macro will point to the right file. Also HDRDVmetadata_L5.json and HDRDVmetadata_Config.json are files to help the Dolby Vision feature (as the name suggests), they are not relevant for the encoder.

if the file is DV/HDR or DV/HDR10 (not +)

Which is the same by definition.

If the video file is HDR10+ the entry is correct however if the file is DV/HDR or DV/HDR10 (not +) the entry is blank.

Of course the macro cannot point at a file that does not exist, because it could not be extracted.

Meanwhile since v2.42 the Dolby Vision Profile 5 metadata is also set via Import VUI metadata, so that issue should be gone. And for each situation or configuration everything can be set up by choosing the right options. So from my side this issue seems to be done. There should be no reason to bypass this feature and when you think you have to do it, you have to do all steps on your own.

Nevertheless I think I will make some more improvements/changes regarding the Dolby Vision handling in v2.43.

noblemd00 commented 2 days ago

Disabled all Event commands that set HDR Info file...

HDR format: Dolby Vision, Version 1.0, Profile 7.6, dvhe.07.06, BL+EL+RPU, no metadata compression, Blu-ray compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible

HDRDVmetadata_L5.json file is present in Temp dir.

and after loading source the HDR10 Info File was blank (HDRDVmetadata.rpu entry ok).

Same thing happened with... HDR format: Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible

The macro will point to the right file. Also HDRDVmetadata_L5.json and HDRDVmetadata_Config.json are files to help the Dolby Vision feature (as the name suggests), they are not relevant for the encoder.

I was under the impression that the HDR10 Info file (HDRDVmetadata_L5.json, HDRDVmetadata_Config.json) was required for proper compatible playback on HDR10 (not DV) TVs?

But, after testing, it appears they are not (re-encoded files with blank HDR10 Info File entry playback as HDR - see settings below).

Also for proper compatible playback on HDR(10+) only TV the following settings are required: Tested 'Auto' for ATC SEI and the result was no HDR playback. Colorrange 'Full' resulted in the picture being to bright.

Also, with the settings below playback on Dolby Vision TV is proper.

240911 095408
Dendraspis commented 1 day ago

and after loading source the HDR10 Info File was blank (HDRDVmetadata.rpu entry ok).

That's good.

I was under the impression that the HDR10 Info file (HDRDVmetadata_L5.json, HDRDVmetadata_Config.json) was required for proper compatible playback on HDR10 (not DV) TVs?

HDR10 Info file is a for HDR10+ JSON files.

Also for proper compatible playback on HDR(10+) only TV the following settings are required:

All TVs should be able to play HDR10 which is available in both of your sources. But there is nothing like HDR10+ only.

Also, with the settings below playback on Dolby Vision TV is proper.

Looks like the default settings for me.

noblemd00 commented 1 day ago

But there is nothing like HDR10+ only

I'm trying to figure out what you mean by this - HDR10+ only encoded video files (without Dolby Vision encoding) definitely exist!

I have video files that are MediaInfo listed as... HDR format: SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile B compatible and HDR format: SMPTE ST 2094 App 4, HDR10+ Profile B compatible

Dendraspis commented 1 day ago

I'm trying to figure out what you mean by this - HDR10+ only encoded video files (without Dolby Vision encoding) definitely exist!

HDR10 is not HDR10+ !!

HDR10+ builds up on top of HDR10, so every HDR10+ video has a HDR10 fallback. Dolby Vision is similar, but can be used without HDR10 layer by using Profile 5.

Dendraspis commented 2 hours ago

This has nothing to do with your original request. Please open a new feature request for that.

So I am closing this issue now...