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

HDR setting applied to autoProcess.ini but not being carried over during Transcoding\Remux #1285

Closed
Weezzel opened this issue Jul 24, 2020 · 113 comments

Comments

@Weezzel
Copy link

Weezzel commented Jul 24, 2020

HDR setting applied to autoProcess.ini and seem to be pushed to the manual.py. They are being Identified from the original file and processing is successful but transcoded\remuxed copy does not have the correct Metadata

I don't think that the Master display & Max cll\Max fall needed for HDR10 is being carried over.

Mastering Display_Maxcll-fall

sma.log

2020-07-24` 09:08:33 - MANUAL - INFO - Reading video stream.
2020-07-24 09:08:33 - MANUAL - INFO - Video codec detected: hevc.
2020-07-24 09:08:33 - MANUAL - INFO - Pix Fmt: yuv420p10le.
2020-07-24 09:08:33 - MANUAL - INFO - Profile: main 10.
2020-07-24 09:08:33 - MANUAL - INFO - HDR video stream detected for 0.
2020-07-24 09:08:33 - MANUAL - INFO - Reading audio streams.
2020-07-24 09:08:33 - MANUAL - INFO - Audio detected for stream 1 - eac3 eng 6 channel.
2020-07-24 09:08:33 - MANUAL - INFO - Creating aac audio stream source audio stream 1 [universal-audio].
2020-07-24 09:08:33 - MANUAL - INFO - Creating copy audio stream from source stream 1.
2020-07-24 09:08:33 - MANUAL - INFO - Default audio stream set to eng copy 6 channel stream [default-more-channels: True].
2020-07-24 09:08:33 - MANUAL - INFO - Reading subtitle streams.
2020-07-24 09:08:34 - MANUAL - INFO - Text-based subtitle detected for stream 2 - subrip eng.
2020-07-24 09:08:34 - MANUAL - INFO - Creating mov_text subtitle stream from source stream 2.
2020-07-24 09:08:34 - MANUAL - INFO - Text-based subtitle detected for stream 3 - subrip eng.
2020-07-24 09:08:35 - MANUAL - INFO - Text-based subtitle detected for stream 4 - subrip spa.
2020-07-24 09:08:35 - MANUAL - INFO - Text-based subtitle detected for stream 5 - subrip spa.
2020-07-24 09:08:35 - MANUAL - INFO - Text-based subtitle detected for stream 6 - subrip fra.
2020-07-24 09:08:35 - MANUAL - INFO - Text-based subtitle detected for stream 7 - subrip deu.
2020-07-24 09:08:36 - MANUAL - INFO - Text-based subtitle detected for stream 8 - subrip ita.
2020-07-24 09:08:36 - MANUAL - INFO - Text-based subtitle detected for stream 9 - subrip por.
2020-07-24 09:08:37 - MANUAL - INFO - Text-based subtitle detected for stream 10 - subrip por.
2020-07-24 09:08:38 - MANUAL - INFO - Text-based subtitle detected for stream 11 - subrip pol.
2020-07-24 09:08:38 - MANUAL - INFO - Text-based subtitle detected for stream 12 - subrip tur.
2020-07-24 09:08:38 - MANUAL - INFO - Text-based subtitle detected for stream 13 - subrip swe.
2020-07-24 09:08:39 - MANUAL - INFO - Text-based subtitle detected for stream 14 - subrip dan.
2020-07-24 09:08:39 - MANUAL - INFO - Text-based subtitle detected for stream 15 - subrip fin.
2020-07-24 09:08:39 - MANUAL - INFO - Text-based subtitle detected for stream 16 - subrip nld.
2020-07-24 09:08:40 - MANUAL - INFO - Text-based subtitle detected for stream 17 - subrip nor.
2020-07-24 09:08:40 - MANUAL - INFO - Text-based subtitle detected for stream 18 - subrip rus.
2020-07-24 09:08:40 - MANUAL - INFO - Text-based subtitle detected for stream 19 - subrip hun.
2020-07-24 09:08:41 - MANUAL - INFO - Text-based subtitle detected for stream 20 - subrip ell.
2020-07-24 09:08:41 - MANUAL - INFO - Text-based subtitle detected for stream 21 - subrip heb.
2020-07-24 09:08:41 - MANUAL - INFO - Text-based subtitle detected for stream 22 - subrip ara.
2020-07-24 09:08:42 - MANUAL - INFO - Text-based subtitle detected for stream 23 - subrip ron.
2020-07-24 09:08:42 - MANUAL - INFO - Text-based subtitle detected for stream 24 - subrip ces.
2020-07-24 09:08:42 - MANUAL - INFO - Text-based subtitle detected for stream 25 - subrip ind.
2020-07-24 09:08:43 - MANUAL - INFO - Text-based subtitle detected for stream 26 - subrip vie.
2020-07-24 09:08:43 - MANUAL - INFO - Text-based subtitle detected for stream 27 - subrip tha.
2020-07-24 09:08:43 - MANUAL - INFO - Text-based subtitle detected for stream 28 - subrip kor.
2020-07-24 09:08:44 - MANUAL - INFO - Text-based subtitle detected for stream 29 - subrip zho.
2020-07-24 09:08:44 - MANUAL - INFO - Text-based subtitle detected for stream 30 - subrip zho.
2020-07-24 09:08:44 - MANUAL - INFO - Text-based subtitle detected for stream 31 - subrip jpn.
2020-07-24 09:08:45 - MANUAL - INFO - cuda hwaccel is supported by this ffmpeg build and will be used [hwaccels].
2020-07-24 09:08:45 - MANUAL - INFO - Output Data
2020-07-24 09:08:45 - MANUAL - INFO - {
"source": [
"D:\TV\13 Reasons Why (2017)\Season 03\13 Reasons Why.S03E01.Yeah. I'm the New Girl.WEBDL-1080p.HEVC.EAC3-5.1.HDR-MZABI.mkv"
],
"format": "mp4",
"video": {
"codec": "h265_nvenc",
"map": 0,
"bitrate": 5787.0,
"crf": -18,
"maxrate": null,
"bufsize": null,
"level": 5.1,
"profile": "main10",
"pix_fmt": null,
"field_order": "unknown",
"width": null,
"filter": null,
"title": "FHD HDR",
"debug": "video.max-level.profile"
},
"audio": [
{
"map": 1,
"codec": "aac",
"channels": 2,
"bitrate": 256,
"samplerate": null,
"filter": null,
"language": "eng",
"disposition": "-default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired",
"title": "Stereo",
"debug": "universal-audio"
},
{
"map": 1,
"codec": "copy",
"channels": 6,
"bitrate": 1536,
"filter": null,
"samplerate": null,
"language": "eng",
"disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired",
"bsf": null,
"title": "5.1 Channel",
"debug": "audio"
}
],
"subtitle": [
{
"map": 2,
"codec": "mov_text",
"language": "eng",
"encoding": "",
"disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired",
"title": "",
"debug": "subtitle.embed-subs"
}
],
"attachment": []
}
2020-07-24 09:08:45 - MANUAL - INFO - Preopts
2020-07-24 09:08:45 - MANUAL - INFO - [
"-fix_sub_duration",
"-hwaccel",
"cuda",
"-loglevel",
"debug",
"-probesize",
"1000000",
"-analyzeduration",
"10000000"
]
2020-07-24 09:08:45 - MANUAL - INFO - Postopts
2020-07-24 09:08:45 - MANUAL - INFO - [
"-threads",
"0",
"-metadata:g",
"encoding_tool=SMA"
]
2020-07-24 09:08:45 - MANUAL - INFO - Starting conversion.
2020-07-24 09:16:55 - MANUAL - INFO - D:\TV\13 Reasons Why (2017)\Season 03\13 Reasons Why.S03E01.Yeah. I'm the New Girl.WEBDL-1080p.HEVC.EAC3-5.1.HDR-MZABI.mp4 created.
2020-07-24 09:16:56 - MANUAL - INFO - Tagging file: D:\TV\13 Reasons Why (2017)\Season 03\13 Reasons Why.S03E01.Yeah. I'm the New Girl.WEBDL-1080p.HEVC.EAC3-5.1.HDR-MZABI.mp4.
2020-07-24 09:16:56 - MANUAL - INFO - Trying to write tags.
2020-07-24 09:16:56 - MANUAL - INFO - Tags written successfully using mutagen.
2020-07-24 09:16:56 - MANUAL - INFO - Relocating MOOV atom to start of file.
2020-07-24 09:20:04 - MANUAL - INFO - Manual processor started.
2020-07-24 09:20:04 - MANUAL - INFO - C:\Python38\python.exe
2020-07-24 09:20:04 - MANUAL - INFO - Loading config file C:\Sick_MP4\config\autoProcess.ini.
2020-07-24 09:20:04 - MANUAL - INFO - Processing file D:\TV\13 Reasons Why (2017)\Season 03\13 Reasons Why.S03E01.Yeah. I'm the New Girl.WEBDL-1080p.HEVC.EAC3-5.1.HDR-MZABI.mp4
2020-07-24 09:20:06 - MANUAL - INFO - Matched TV episode as 13 Reasons Why (TMDB ID: 66788) S03E01
2020-07-24 09:20:06 - MANUAL - INFO - Processing 13 Reasons Why Season 03 Episode 01 - Yeah. I'm the New Girl
2020-07-24 09:20:06 - MANUAL - INFO - Input and output extensions are the same so passing back the original file [process-same-extensions: False].
2020-07-24 09:20:06 - MANUAL - INFO - Bypassing conversion and setting outputfile to inputfile.
2020-07-24 09:20:06 - MANUAL - INFO - Tagging file: D:\TV\13 Reasons Why (2017)\Season 03\13 Reasons Why.S03E01.Yeah. I'm the New Girl.WEBDL-1080p.HEVC.EAC3-5.1.HDR-MZABI.mp4.
2020-07-24 09:20:07 - MANUAL - INFO - Trying to write tags.
2020-07-24 09:20:09 - MANUAL - INFO - Tags written successfully using mutagen.
2020-07-24 09:20:11 - MANUAL - INFO - Relocating MOOV atom to start of file.
2020-07-24 09:20:11 - MANUAL - WARNING - QT FastStart did not run - perhaps moov atom was at the start already or file is in the wrong format.

autoProcess.zip

[Converter]
ffmpeg = ffmpeg.exe
ffprobe = ffprobe.exe
threads = 0
hwaccels = hevc_cuvid,cuda,dxva2,d3d11va,qsv
hwaccel-decoders = h265_nvenc,hevc_cuvid,h265_cuvid,hevc_nvenc
output-directory =
output-format = mp4
output-extension = mp4
temp-extension =
minimum-size = 0
ignored-extensions = nfo, ds_store
copy-to =
move-to =
delete-original = True
sort-streams = True
process-same-extensions = False
force-convert = False
post-process = False
preopts = -loglevel,debug,-probesize,1000000,-analyzeduration,10000000
postopts =

[Permissions]
chmod = 0644
uid = -1
gid = -1

[Metadata]
relocate-moov = True
full-path-guess = True
tag = True
tag-language = eng
download-artwork = poster
sanitize-disposition =

[Video]
codec = h265_nvenc,h265,x265
max-bitrate = 0
crf = -18
crf-profiles =
max-width = 0
profile = Main10
max-level = 5.1
pix-fmt = yuv420p10le,p010le
filter =
force-filter = False

[HDR]
space = bt2020nc
transfer = smpte2084
primaries = bt2020
filter =
force-filter = False

[Audio]
codec = eac3,TrueHD,dts,ac3,flac
languages = eng
default-language = eng
first-stream-of-language = False
allow-language-relax = True
channel-bitrate = 256
max-bitrate = 0
max-channels = 0
prefer-more-channels = True
default-more-channels = True
filter =
force-filter = False
sample-rates =
copy-original = False
aac-adtstoasc = False
ignore-truehd = false

[Universal Audio]
codec = aac
channel-bitrate = 128
first-stream-only = False
move-after = True
filter =
force-filter = False

[Subtitle]
codec = mov_text
codec-image-based = copy,sup,subrip,dvdsub,ass,pgs,pgssub,hdmv_pgs_subtitle
languages = eng
default-language = eng
first-stream-of-language = True
encoding =
burn-subtitles = False
burn-dispositions =
download-subs = False
download-hearing-impaired-subs = False
download-providers =
embed-subs = True
embed-image-subs = True
embed-only-internal-subs = True
filename-dispositions = forced
ignore-embedded-subs = False
attachment-codec =

Pictures of File Before script:

Before proccessing
Before 1
Before 2
Before 1_LI
Screenshot (10)

After running the manual.py script:

After
After processing
After2
after3

@mdhiggins
Copy link
Owner

This will be very challenging to fix due to limitations with FFMPEG and FFPROBE
Can read more about it here
https://forum.doom9.org/showthread.php?t=175227

But unless you can figure out a way to read those values via FFPROBE and reliable include them in the params for the command generated for the output file I'm not sure how else to fix it.

If you can find where to read that info and post some resulting FFMPEG commands that generate what you're after I can try and build it

@Weezzel
Copy link
Author

Weezzel commented Jul 26, 2020

I know others have been using the --master-display option and the Maxcll\fall options in a CLI script, I just dont know were to add it to you autoprocess.ini file.
here are some examples.

http://x265.readthedocs.io/en/default/cli.html

--master-display
SMPTE ST 2086 mastering display color volume SEI info, specified as a string which is parsed when the stream header SEI are emitted. The string format is “G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u)” where %hu are unsigned 16bit integers and %u are unsigned 32bit integers. The SEI includes X,Y display primaries for RGB channels and white point (WP) in units of 0.00002 and max,min luminance (L) values in units of 0.0001 candela per meter square. Applicable for HDR content.

Example for a P3D65 1000-nits monitor, where G(x=0.265, y=0.690), B(x=0.150, y=0.060), R(x=0.680, y=0.320), WP(x=0.3127, y=0.3290), L(max=1000, min=0.0001):

G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)
Note that this string value will need to be escaped or quoted to protect against shell expansion on many platforms. No default.

--max-cll
Maximum content light level (MaxCLL) and maximum frame average light level (MaxFALL) as required by the Consumer Electronics Association 861.3 specification.

Specified as a string which is parsed when the stream header SEI are emitted. The string format is “%hu,%hu” where %hu are unsigned 16bit integers. The first value is the max content light level (or 0 if no maximum is indicated), the second value is the maximum picture average light level (or 0). Applicable for HDR content.

Example for MaxCLL=1000 candela per square meter, MaxFALL=400 candela per square meter:

–max-cll ?1000,400?
Note that this string value will need to be escaped or quoted to protect against shell expansion on many platforms. No default.

people have been doing this in CLI without issues. so how do i convert this to work in your script and were do I place it?

if I add this to postopt =x265-parm, -master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)", –max-cll ?1000,400? I get an error.

If I add it to the HDR filter= x265-parm, -master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)", –max-cll "1000,400" I get error saying not a corret filter or something like that.

More Research done here:

DCI-P3: --master-display G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1) --max-cll 1000,1
RGB: G(x=0.265, y=0.690), B(x=0.150, y=0.060), R(x=0.680, y=0.320), WP(x=0.3127, y=0.329), L(max=1000, min=0.0000)

Rec.709: --master-display G(15000,30000)B(7500,3000)R(32000,16500)WP(15635,16450)L(10000000,1) --max-cll 1000,1
RGB: G(x=0.30, y=0.60), B(x=0.150, y=0.060), R(x=0.640, y=0.330), WP(x=0.3127,y=0.329), L(max=1000, min=0.0000)

Rec.2020: --master-display G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,1) --max-cll 1000,1
RGB: G(x=0.170, y=0.797), B(x=0.131, y=0.046), R(x=0.708, y=0.292), WP(x=0.3127,y=0.329), L(max=1000, min=0.0000)

To convert, simply divide the RGB values by 0.00002
Sample for "Display P3":
0.265 / 0.00002 = 13250
0.69 / 0.00002 = 34500
0.15 / 0.00002 = 7500
0.06 / 0.00002 = 3000
0.68 / 0.00002 = 34000
0.32 / 0.00002 = 16000
0.3127 / 0.00002 = 15635
0.329 / 0.00002 = 16450

Information:
https://en.wikipedia.org/wiki/DCI-P3
https://en.wikipedia.org/wiki/Rec._709
https://en.wikipedia.org/wiki/Rec._2020

https://www.smpte.org/sites/default/files/section-files/HDR.pdf

@mdhiggins
Copy link
Owner

mdhiggins commented Jul 30, 2020

Definitely formatted things incorrectly above but there's also some additional challenge here because postopts is normally split by commas which are included in your master-display parameter

-x265-param master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400

I went ahead and added an option called codec-parameters both under the video section and hdr section of the config file

This will work for h264 and h265

for your HDR profile set it like this
codec-parameters = master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400

fb8657a

that will create an -x265-params argument with those options when generating the command

@mdhiggins
Copy link
Owner

Any updates on if this solution is working for you?

@mdhiggins
Copy link
Owner

Closing for now, feel free to continue discussion or reopen if there are bugs

@Weezzel
Copy link
Author

Weezzel commented Aug 7, 2020

sorry got called out to travel for work to a remote location and didn't have access to my server that runs all the Transcoding scripts. will check this out further and post update..

Thank you for the quick response.

@mdhiggins
Copy link
Owner

No problem just update when you can if this helps

@Weezzel
Copy link
Author

Weezzel commented Aug 8, 2020

Ok, so I had some time to run the script with the new changes. I deleted install directory and use GIT to pull down the new source. So I would have all the new changes with the correct autoProcess.ini. I put in all the modification I wanted in the autoProcess.ini. I have tried 2 different ways to add the HDR metadata or copy over the HDR Metadata as stated in your updated WIKI.

Here is my SMA.Log of this conversation:
sma.log

My AutoProcess.ini:
autoProcess.ini.txt

First option:
**


> [HDR]
> space = bt2020nc
> transfer = smpte2084
> primaries = bt2020
> codec-parameters = master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400
> filter = 
> force-filter = False

**

Second option:

> **[Video]
> codec = h265_nvenc, h265, x265, h265vaapi, hevc
> max-bitrate = 0
> crf = 23
> crf-profiles = 
> codec-parameters = colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400
> max-width = 0
> profile = Main10
> max-level = 5.1
> pix-fmt = p010le, yuv420p10le
> filter = 
> force-filter = False**

Third Option with both of them added:
**

> [Video]
> codec = h265, x265, hevc, h265_nvenc
> max-bitrate = 0
> crf = 23
> crf-profiles = 
> codec-parameters = colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400
> max-width = 0
> profile = Main10
> max-level = 5.1
> pix-fmt = p010le, yuv420p10le
> filter = 
> force-filter = False
> 
> [HDR]
> space = bt2020nc
> transfer = smpte2084
> primaries = bt2020
> codec-parameters = master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400
> filter = 
> force-filter = False

**

All of these options are NOT copying over the HDR Metadata:

Source file are:
Absentia.S03E03.Nosce Inimicum.WEBDL-2160p.h265.EAC3-5.1.HDR-ROCCaT.mkv.mediainfo.json.txt

> "@type": "Video",
> "StreamOrder": "0",
> "ID": "1",
> "UniqueID": "17140451369682069101",
> "Format": "HEVC",
> "Format_Profile": "Main 10",
> "Format_Level": "5",
> "Format_Tier": "Main",
> "HDR_Format": "SMPTE ST 2094 App 4",
> "HDR_Format_Version": "0",
> "CodecID": "V_MPEGH/ISO/HEVC",
> "Duration": "2410.533000000",
> "BitRate": "14295554",
> "Width": "3840",
> "Height": "2160",
> "Sampled_Width": "3840",
> "Sampled_Height": "2160",
> "PixelAspectRatio": "1.000",
> "DisplayAspectRatio": "1.778",
> "FrameRate_Mode": "CFR",
> "FrameRate": "23.976",
> "FrameCount": "57795",
> "Standard": "NTSC",
> "ColorSpace": "YUV",
> "ChromaSubsampling": "4:2:0",
> "ChromaSubsampling_Position": "Type 2",
> "BitDepth": "10",
> "Delay": "0.000",
> "StreamSize": "4307488384",
> "Default": "Yes",
> "Forced": "No",
> "colour_description_present": "Yes",
> "colour_description_present_Source": "Stream",
> "colour_range": "Limited",
> "colour_range_Source": "Stream",
> "colour_primaries": "BT.2020",
> "colour_primaries_Source": "Stream",
> "transfer_characteristics": "PQ",
> "transfer_characteristics_Source": "Stream",
> "matrix_coefficients": "BT.2020 non-constant",
> "matrix_coefficients_Source": "Stream",
> "MasteringDisplay_ColorPrimaries": "Display P3",
> "MasteringDisplay_ColorPrimaries_Source": "Stream",
> "MasteringDisplay_Luminance": "min: 0.0001 cd/m2, max: 1000 cd/m2",
> "MasteringDisplay_Luminance_Source": "Stream",
> "MaxCLL": "4001 cd/m2",
> "MaxCLL_Source": "Stream",
> "MaxFALL": "1910 cd/m2",
> "MaxFALL_Source": "Stream"
> },
> 

After Conversion File is not having HDR Metadata, This file is not the same name as I forgot to set Delete original=false, but the metadata informations is the same just with a different episode:
Absentia.S03E02.Capta Est.WEBDL-2160p.h265.EAC3-5.1.HDR-ROCCaT.mp4.mediainfo.json.txt

 "@type": "Video",
 "StreamOrder": "0",
 "ID": "1",
 "Format": "HEVC",
 "Format_Profile": "Main 10",
 "Format_Level": "5.1",
 "Format_Tier": "Main",
 "CodecID": "hvc1",
 "Duration": "2673.588",
 "BitRate": "1273810",
 "Width": "3840",
 "Height": "2160",
 "Stored_Height": "2176",
 "Sampled_Width": "3840",
 "Sampled_Height": "2160",
 "PixelAspectRatio": "1.000",
 "DisplayAspectRatio": "1.778",
 "Rotation": "0.000",
 "FrameRate_Mode": "CFR",
 "FrameRate": "23.976",
 "FrameCount": "64102",
 "ColorSpace": "YUV",
 "ChromaSubsampling": "4:2:0",
 "BitDepth": "10",
 "ScanType": "Progressive",
 "StreamSize": "425705859",
 "Title": "4K HDR",
 "extra": {
 "CodecConfigurationBox": "hvcC"
 

I just noticed this from the source file:Could this be an Issue?

"HDR_Format": "SMPTE ST 2094 App 4",
"HDR_Format_Version": "0",

A Document on SMPTE ST 2094
2017-01-12-ST-2094-Borg-V2-Handout.pdf
A Document on all HDR Options
HDR_Master_Class_SMPTE_Atlanta.pdf

Found this with some great info and Options:
From: FileBot.net [SNIPPET] HDR detection

`[SNIPPET] HDR detection
Post by devster » 02 Sep 2019, 19:55

As Mediainfo was updated to include HDR detection, this is a snippet to take full advantage of it.
The map currently detects HDR10, HDR10+ and Dolby Vision.
CODE: SELECT ALL

{
	def _HDRMap = [
		"HDR10": "HDR10",
		"SMPTE ST 2086": "HDR10",
		"SMPTE ST 2094 App 4": "HDR10+",
		"Dolby Vision / SMPTE ST 2086": "Dolby Vision",
		"Dolby Vision / HDR10": "Dolby Vision",
	]
	def vid = video.first()
	allOf
		{ vf }
		{ vc }
		{ 
			String _HDR
			switch (bitdepth) {
				case { it > 8 }:
					_HDR = any
				   		{ vid["HDR_Format_Commercial"] }
				   		{ vid["HDR_Format"] }
				   		{ hdr }
				   		{ null }
						// { vid["HDR_Format/String"] }
						// { vid["HDR_Format_Compatibility"] }
						// following for both HDR10+ (misses compatibility) and Dolby Vision
						// { vid["HDR_Format_Version"] }
						// following only for Dolby Vision
						// { vid["HDR_Format_Profile"] }
						// { vid["HDR_Format_Level"] }
						// { vid["HDR_Format_Settings"] }
					break
				default:
					"$bitdepth-bit"
				break
			}
			// _HDRMap.get(_HDR, _HDR)
			_HDRMap.find { k, v ->
				k =~ _HDR
			}?.value
		}
	.join(" ")
}
Very unsure about the groovy at the end, this bit in particular:
CODE: SELECT ALL

			_HDRMap.get(_HDR, _HDR)
			// OR
			_HDRMap.find { k, v ->
				k =~ _HDR
			}.value
which seems wonky but works for now.

UPDATE 2019-09-03 -> changed _HDRMap.find{...}.value to _HDRMap.find{...}?.value, should be null if no key is found.`

So I am at a loss, on this. Am I forgetting something? Or are my settings to low to allow for the extra metadata, Or could it be the h265_nvenc option not allowing for the metadata transfer? Should I only use "h265, x265, hevc" My Video card is a Nvidia RTX2070 Super, So I know that its capable to produce just about anything. I have installed MS Visual studio 2019, Cuda Toolkit 11 and python 3.8.5 which are all required for the "h265_nvenc" to provide gpu hwaccels and Nvidia\Nvenc support.

👍Please dont take this a a troll or a slam. I am admire your skills and wish I had them to be more supportive of things like this to were I would be more of an contributor than a pain in the ass "saying this dont work".
I dont want to compare peoples works "scripts" but I have been able to get Collisionc/sickbeard_mp4_automator to work with just these options: "postopts = -x265-params, :colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084". But his autoPrcoess.ini script is a lot different than yours. I Prefer yours as it seems to be cleaner and maintainded more. Well definitely maintained more, you are very active on your source code and that is a BIG PLUS, that I think most of us that are working with this type of source code so appreciate. I have attached his autoPrcoess.ini but the differences that his source code is primarily Nvidia support which attacked me to right aways. Honestly if both of you were to combine your works you guys would OWN this Source\Platform. You use the more current PIP Installs that are required and his use some of the more outdated PIP requirements. Which makes it difficult to switch back and forth, as I have to uninstall all the PIP's to use his.

😎Again Please DON'T take any of this a a Slam\Flame\Trolling it is not intended that way at all. I am sincerely wanting to help in this growth of you source\platform, by providing feedback that I hope will stimulate growth\ progression👍
Collisionic_autoProcess.ini.txt

@mdhiggins
Copy link
Owner

So from your conversion log everything looks like its working as intended. Its detecting HDR and its applying the -x265-params that you have set in your config. If there's any issue beyond that its probably with the formulation of the -x265-params.
Collisionc's script is just a fork of an older version of my script and the postopts implementation is the same I believe. You could use the same postopts settings in my version of the script and probably achieve the same results, its not doing anything fancy.

You're doing a little comparison of apples to oranges here since you're using 2 different sets of -x265-params between the two scripts which may be where the problem lies. Do things change when you using the exact same -x265-params?

Ultimately both scripts are just creating FFMPEG commands so if you have a working FFMPEG command that's generated by the other script just post that so we can compare the difference between the two commands generated and sort out why things aren't working cause its probably some subtle difference that's causing FFMPEG to not behave. It may be that there's just a missing NVENC option that's required to get FFMPEG to write those tags.

I will say this script should have full hardware acceleration support for encoding and decoding and that includes nvidia based codecs, though not nearly as many specific options as Collisionc's implementation but I have improved the hw-acceleration options substantially recently

@morpheus2n2
Copy link

morpheus2n2 commented Aug 18, 2020

Sorry to jump on this one, is the problem just that the HDR metadata isn't being copied over as from what I can tell the files plays just fine with HDR if I manually set TV to HDR mode, its just not being correctly labelled or picked up which obviously would be helpful.

@mdhiggins
Copy link
Owner

I'm not sure the x265-params option is applied when you use hardware encoding, believe that option is exclusive to software encoding

@mdhiggins
Copy link
Owner

Does the option work if you use software encoding?

If you want support for hardware encoding with tags please provide a sample FFmpeg command that does that and I'll find a way to incorporate it

@morpheus2n2
Copy link

Ahh ok, well I found this if its any help https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/

@mdhiggins
Copy link
Owner

Just give me a sample ffmpeg command that does what you want and I'll incorporate it, preferably with a comparison of the command the script is currently generating

@morpheus2n2
Copy link

Sorry If I wasn't clear, I don't know what the command it is I'm currently trying to figure it out using the above link.
I was simply asking if the previous problem the OP was having was around just the metadata, as when using your script as normal it seemed to copy the HDR over just not "Tag" it as such so my TV didn't auto pick it up.

Sorry about the miss understanding that was my bad :D

@mdhiggins
Copy link
Owner

mdhiggins commented Aug 18, 2020

Try setting your params to

:colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084 (and don't delete the leading :)

@morpheus2n2
Copy link

Yes you are right that copying the HDR metadata is software only, have just found some forums post to confirm this (although there 2 years old so HW may support this now but I doubt it)

Ok will do and will run another test, also I have just run across a script that seems to add the metadata in to HW encoded files not sure if its something that can be cannibalised and added in as a postprocess e.g once your scripts has finished with the encoding this runs quick before the file is finished with?

@morpheus2n2
Copy link

Quick update ran the test using the params you said, and it work great in software as expected, while slow it gave be the desired results and was picked up fine 👍

@mdhiggins
Copy link
Owner

See if those params work with nvenc cause they might. I do see some updates that indicate maybe they'll work it's probably worth a shot. Apparently it was working for @Weezzel using nvenc on collisions fork

@morpheus2n2
Copy link

Unfortunately they don't while yes it most definitely dose encode keeping HDR it doesn't add HDR metadata to the stream so mediainfo, and my TV don't pick it up, however if I set my TV to HDR while play said file it looks just like the original source file.
as for it working on the other fork not sure if there's something else going on there or what lol

Hope that makes since

Its all good though as I don't have or plan on having loads of stuff in HDR so doing it slowly for the few things I want is no big deal :D

@mdhiggins
Copy link
Owner

@Weezzel If you could post the command that works for nvenc from Collisions fork it would be very much appreciated cause it would be nice to preserve the metadata and that command is probably all I need to make it work

@mdhiggins
Copy link
Owner

It actually looks like he had posted a few things in this regard years ago

https://github.com/Collisionc/sickbeard_mp4_automator/issues/21
https://github.com/Collisionc/sickbeard_mp4_automator/issues/16

Very strange since this seems to be the same question that was asked a year ago

And was basically solved by inserting post opts which should be fine, only difference was that the level was included which who knows is maybe required. The params option should work instead of post opts but I think maybe we just need to tweak the param itself

Try

level=5.2:colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084

but it was definitely working with nvenc at some point unless there was a regression with FFmpeg that broke things. If you could post the FFmpeg command that's generated even if it fails I would appreciate it

@morpheus2n2
Copy link

Ok will give it a try now

@morpheus2n2
Copy link

Ok using them param don't work lol

@mdhiggins
Copy link
Owner

Can you post the command that gets generated?

@morpheus2n2
Copy link

morpheus2n2 commented Aug 19, 2020

Yep sorry.

2020-08-19 01:54:31 - MANUAL - INFO - Starting conversion.
2020-08-19 01:54:31 - MANUAL - INFO - FFmpeg command:
2020-08-19 01:54:31 - MANUAL - INFO - ======================
2020-08-19 01:54:31 - MANUAL - INFO - C:\ffmpeg\bin\ffmpeg.exe -fix_sub_duration -hwaccel dxva2 -loglevel debug -probesize 1000000 -analyzeduration 10000000 -i d:\downloads\test\Star.Trek.Picard.S01E01.HDR.1080p.WEB.h265-TRUMP.mkv -vcodec hevc_nvenc -map 0:0 -vb 1600k -metadata:s:v BPS=1600000 -metadata:s:v BPS-eng=1600000 -metadata:s:v title=FHD HDR -profile:v main10 -level 5.0 -x265-params master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1):max-cll=1000,400 -tag:v hvc1 -c:a:0 aac -map 0:1 -ac:a:0 2 -b:a:0 256k -metadata:s:a:0 BPS=256000 -metadata:s:a:0 BPS-eng=256000 -metadata:s:a:0 title=Stereo -metadata:s:a:0 language=eng -disposition:a:0 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -strict experimental -c:a:1 copy -map 0:1 -metadata:s:a:1 title=5.1 Channel -metadata:s:a:1 language=eng -disposition:a:1 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -c:s:0 mov_text -map 0:2 -metadata:s:s:0 title= -metadata:s:s:0 language=eng -disposition:s:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y d:\downloads\test\Star.Trek.Picard.S01E01.HDR.1080p.WEB.h265-TRUMP.mp4
2020-08-19 01:54:31 - MANUAL - INFO - ======================

@mdhiggins
Copy link
Owner

So it looks like those aren't the right params! You sure you updated things in autoprocess? Just FYI the params in the HDR section only apply if the source material is HDR so maybe those are the params from the video section but please try the other params listed before

@morpheus2n2
Copy link

🤦 I updated the wrong params, this is the new output, still no copy over

Params first mention
C:\ffmpeg\bin\ffmpeg.exe -fix_sub_duration -hwaccel dxva2 -loglevel debug -probesize 1000000 -analyzeduration 10000000 -i d:\downloads\test\Star.Trek.Picard.S01E01.HDR.1080p.WEB.h265-TRUMP.mkv -vcodec hevc_nvenc -map 0:0 -vb 1600k -metadata:s:v BPS=1600000 -metadata:s:v BPS-eng=1600000 -metadata:s:v title=FHD HDR -profile:v main10 -level 5.1 -x265-params :colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084 -tag:v hvc1 -c:a:0 aac -map 0:1 -ac:a:0 2 -b:a:0 256k -metadata:s:a:0 BPS=256000 -metadata:s:a:0 BPS-eng=256000 -metadata:s:a:0 title=Stereo -metadata:s:a:0 language=eng -disposition:a:0 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -strict experimental -c:a:1 copy -map 0:1 -metadata:s:a:1 title=5.1 Channel -metadata:s:a:1 language=eng -disposition:a:1 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -c:s:0 mov_text -map 0:2 -metadata:s:s:0 title= -metadata:s:s:0 language=eng -disposition:s:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y d:\downloads\test\Star.Trek.Picard.S01E01.HDR.1080p.WEB.h265-TRUMP.mp4

Params above
C:\ffmpeg\bin\ffmpeg.exe -fix_sub_duration -hwaccel dxva2 -loglevel debug -probesize 1000000 -analyzeduration 10000000 -i d:\downloads\test\Star.Trek.Picard.S01E01.HDR.1080p.WEB.h265-TRUMP.mkv -vcodec hevc_nvenc -map 0:0 -vb 1600k -metadata:s:v BPS=1600000 -metadata:s:v BPS-eng=1600000 -metadata:s:v title=FHD HDR -profile:v main10 -level 5.2 -x265-params level=5.2:colorprim=bt2020:colormatrix=bt2020nc:transfer=smpte2084 -tag:v hvc1 -c:a:0 aac -map 0:1 -ac:a:0 2 -b:a:0 256k -metadata:s:a:0 BPS=256000 -metadata:s:a:0 BPS-eng=256000 -metadata:s:a:0 title=Stereo -metadata:s:a:0 language=eng -disposition:a:0 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -strict experimental -c:a:1 copy -map 0:1 -metadata:s:a:1 title=5.1 Channel -metadata:s:a:1 language=eng -disposition:a:1 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -c:s:0 mov_text -map 0:2 -metadata:s:s:0 title= -metadata:s:s:0 language=eng -disposition:s:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y d:\downloads\test\Star.Trek.Picard.S01E01.HDR.1080p.WEB.h265-TRUMP.mp4

@mdhiggins
Copy link
Owner

Does setting an HDR pix-fmt make any difference? I don't see that in the options

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

Also "Too many packets buffered for output stream" looks like its a bad file
Yes removed all hard coded Params.
Not a bad file plays fine on LG TV's,
Could it be a TrueHD issue as not supported on mp4 logs show a lot of Non-increasing DTS in stream 1: packet 3 with DTS 3, packet 4 with DTS 3 & cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)

@mdhiggins
Copy link
Owner

TrueHD does work on some very new builds of FFMPEG though it looks like you're not using the trueHD streams

It does appear cuda/cuvid and nvdec are being initialized which I wonder if they are maybe the problem

[hevc @ 00000204e3602d40] Format cuda chosen by get_format().

[hevc @ 00000204e3602d40] Format cuda requires hwaccel initialisation.

[hevc @ 00000204e3602d40] Loaded lib: nvcuvid.dll

[hevc @ 00000204e3602d40] Loaded sym: cuvidGetDecoderCaps

[hevc @ 00000204e3602d40] Loaded sym: cuvidCreateDecoder

[hevc @ 00000204e3602d40] Loaded sym: cuvidDestroyDecoder

[hevc @ 00000204e3602d40] Loaded sym: cuvidDecodePicture

[hevc @ 00000204e3602d40] Loaded sym: cuvidGetDecodeStatus

[hevc @ 00000204e3602d40] Loaded sym: cuvidReconfigureDecoder

[hevc @ 00000204e3602d40] Loaded sym: cuvidMapVideoFrame64

[hevc @ 00000204e3602d40] Loaded sym: cuvidUnmapVideoFrame64

[hevc @ 00000204e3602d40] Loaded sym: cuvidCtxLockCreate

[hevc @ 00000204e3602d40] Loaded sym: cuvidCtxLockDestroy

[hevc @ 00000204e3602d40] Loaded sym: cuvidCtxLock

[hevc @ 00000204e3602d40] Loaded sym: cuvidCtxUnlock

[hevc @ 00000204e3602d40] Loaded sym: cuvidCreateVideoSource

[hevc @ 00000204e3602d40] Loaded sym: cuvidCreateVideoSourceW

[hevc @ 00000204e3602d40] Loaded sym: cuvidDestroyVideoSource

[hevc @ 00000204e3602d40] Loaded sym: cuvidSetVideoSourceState

[hevc @ 00000204e3602d40] Loaded sym: cuvidGetVideoSourceState

[hevc @ 00000204e3602d40] Loaded sym: cuvidGetSourceVideoFormat

[hevc @ 00000204e3602d40] Loaded sym: cuvidGetSourceAudioFormat

[hevc @ 00000204e3602d40] Loaded sym: cuvidCreateVideoParser

[hevc @ 00000204e3602d40] Loaded sym: cuvidParseVideoData

[hevc @ 00000204e3602d40] Loaded sym: cuvidDestroyVideoParser

I would try removing the hwaccel options from autoprocess and see if that changes things

@morpheus2n2
Copy link

Also "Too many packets buffered for output stream" looks like its a bad file
Yes removed all hard coded Params.
Not a bad file plays fine on LG TV's,
Could it be a TrueHD issue as not supported on mp4 logs show a lot of Non-increasing DTS in stream 1: packet 3 with DTS 3, packet 4 with DTS 3 & cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)

Even if a File plays ok dosn't mean its not bad, all it takes is for just 1bit to be wrong and ffmpeg has a mental brake down despite the file still playing fine on devices etc as they have built in error correction where as ffmpeg doesn't as it deals with the raw data.

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

"I would try removing the hwaccel options from autoprocess and see if that changes things"
sma_logs.zip
Same outcome.
I will try another HDR10 UHD file with atmos

@mdhiggins
Copy link
Owner

Actually, this might just be a queue size issue

Try adding

-max_muxing_queue_size, 9999 to preopts

@morpheus2n2
Copy link

Its defo a setting somewhere as I have done the whole of Season one of Picard and kept the HDR meta and its halfway through doing the Avatar 4k HDR upscale thats kicking about

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

Different Movie Same outcome:
Processing file D:\Movies\John Wick Chapter 3 Parabellum (2019)\John Wick Chapter 3 Parabellum.Remux-2160p.h265.TrueHD Atmos-7.1-OMEGA.mkv
Too many packets buffered for output stream 0:1.

[AVIOContext @ 0000020d1ee45540] Statistics: 0 seeks, 0 writeouts

[hevc @ 0000020d1e79b140] Mastering Display Metadata:

[hevc @ 0000020d1e79b140] r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3127, 0.3290)

[hevc @ 0000020d1e79b140] min_luminance=0.001000, max_luminance=1000.000000

[hevc @ 0000020d1e79b140] Content Light Level Metadata:

[hevc @ 0000020d1e79b140] MaxCLL=1000, MaxFALL=358

[aac @ 0000020d1e795340] Qavg: 52387.383

[aac @ 0000020d1e795340] 2 frames left in the queue on closing

[AVIOContext @ 0000020d1e76ae40] Statistics: 1245445 bytes read, 2 seeks

[hevc @ 0000020d1e79b140] Decoded frame with POC 0.

Conversion failed!

sma logs john wick.zip

@mdhiggins
Copy link
Owner

Definitely try the queue size fix I bet that's it

preopts = -max_muxing_queue_size, 9999

@morpheus2n2
Copy link

Also out of interest can you see how much ram it uses when it try's to run?
Oh and make sure you have the most recent stable release of ffmpeg
as the Too many packets buffered for output stream 0:1 is the issues with both files.
As @mdhiggins said try the queue preout aswell (I don't have this and it works fine, so can only assume its a ffmpeg issue)

@mdhiggins
Copy link
Owner

I actually think this error is because its using eAC3 for stream 0:1 and has nothing to do with the video stream or HDR, there's a few closed issues on here with the same problem and the queue size thing fixed it

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

Dell Power edge server 192GB not memory issues.
sma.zip

[Converter]
ffmpeg = ffmpeg.exe
ffprobe = ffprobe.exe
threads = 0
hwaccels =
hwaccel-decoders = hevc_nvenc,hevc_cuvid, h265_cuvid, h264_cuvid, mjpeg_cuvid, mpeg1_cuvid, mpeg2_cuvid, mpeg4_cuvid, vc1_cuvid
output-directory =
output-format = mp4
output-extension = mp4
temp-extension =
minimum-size = 0
ignored-extensions = nfo, ds_store
copy-to =
move-to =
delete-original = True
sort-streams = True
process-same-extensions = False
force-convert = False
post-process = False
detailed-progress = True
preopts = -loglevel,debug,-probesize,1000000,-analyzeduration,10000000, -max_muxing_queue_size, 9999
postopts =
hwdevices = vaapi:/dev/dri/renderD128
hwaccel-output-format = vaapi:vaapi

[Permissions]
chmod = 0644
uid = -1
gid = -1

[Metadata]
relocate-moov = True
full-path-guess = True
tag = True
tag-language = eng
download-artwork = poster
sanitize-disposition =

[Video]
codec = h265, x265
max-bitrate = 0
crf = -1
crf-profiles = 0:17:4.5M:12M,4100:21:8M:24M,8000:23:10M:30M
codec-parameters =
max-width = 0
profile = Main10
max-level = 5.2
pix-fmt = yuv420p10le
filter =
force-filter = False
dynamic-parameters = true

[HDR]
space = bt2020nc
transfer = smpte2084
primaries = bt2020
codec-parameters =
filter =
force-filter = False
pix-fmt = yuv420p10le

[Audio]
codec = eac3,TrueHD,dts,ac3,flac
languages = eng
default-language = eng
first-stream-of-language = True
allow-language-relax = True
channel-bitrate = 320
max-bitrate = 0
max-channels = 0
prefer-more-channels = True
default-more-channels = True
filter =
force-filter = False
sample-rates = 48000
copy-original = False
aac-adtstoasc = False
ignore-truehd =
ignored-dispositions =
unique-dispositions = True

[Universal Audio]
codec = aac
channel-bitrate = 128
first-stream-only = True
move-after = True
filter =
force-filter = False

[Subtitle]
codec = mov_text,srt
codec-image-based = pgs
languages = eng
default-language = eng
first-stream-of-language = True
encoding =
burn-subtitles = False
burn-dispositions = forced
download-subs = True
download-hearing-impaired-subs = False
download-providers =
embed-subs = True
embed-image-subs = True
embed-only-internal-subs = True
filename-dispositions = forced
ignore-embedded-subs = False
ignored-dispositions =
unique-dispositions = True
attachment-codec =

@mdhiggins
Copy link
Owner

but there is a typo in your preopts that is preventing that from working

    "-max_muxing_queue_size",
    "9999:-loglevel",
    "debug",

C:\FFmpeg\bin-video\ffmpeg.exe -fix_sub_duration -max_muxing_queue_size 9999:-loglevel debug -probesize 1000000

Looks like there's a colon in there somewhere that shouldn't be

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

had to put a ":" in there or else these comands don't work .
preopts = -max_muxing_queue_size, 9999 -loglevel,debug,-probesize,1000000,-analyzeduration,10000000 or
preopts = -loglevel,debug,-probesize,1000000,-analyzeduration,10000000, -max_muxing_queue_size, 9999

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

if I remove -loglevel,debug,-probesize,1000000,-analyzeduration,10000000
and just use preopts = -max_muxing_queue_size, 9999

I get this
Option max_muxing_queue_size (maximum number of packets that can be buffered while waiting for all streams to initialize) cannot be applied to input url D:\Movies\John Wick Chapter 3 Parabellum (2019)\John Wick Chapter 3 Parabellum.Remux-2160p.h265.TrueHD Atmos-7.1-OMEGA.mkv -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file D:\Movies\John Wick Chapter 3 Parabellum (2019)\John Wick Chapter 3 Parabellum.Remux-2160p.h265.TrueHD Atmos-7.1-OMEGA.mkv.
Error opening input files: Invalid argument

@mdhiggins
Copy link
Owner

Shit I'm stupid

Its supposed to be in postopts not preopts
postopts = -max_muxing_queue_size, 9999

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

lol.
I just found that out.. I all so removed
codec-image-based = "pgs"
as I was getting Image subtitle errors not thinking mp4 and Image subtitles dont play together.

0-09-09 17:15:51 - MANUAL - INFO - Preopts
2020-09-09 17:15:51 - MANUAL - INFO - [
"-loglevel",
"debug",
"-probesize",
"1000000",
"-analyzeduration",
"10000000"
]
2020-09-09 17:15:51 - MANUAL - INFO - Postopts
2020-09-09 17:15:51 - MANUAL - INFO - [
"-threads",
"0",
"-metadata:g",
"encoding_tool=SMA",
"-strict",
"experimental",
"-max_muxing_queue_size",
"9999"
]
2020-09-09 17:15:51 - MANUAL - INFO - Downloaded Subtitles
2020-09-09 17:15:51 - MANUAL - INFO - []
2020-09-09 17:15:51 - MANUAL - INFO - Starting conversion.
2020-09-09 17:15:51 - MANUAL - INFO - FFmpeg command:
2020-09-09 17:15:51 - MANUAL - INFO - ======================
2020-09-09 17:15:51 - MANUAL - INFO - C:\FFmpeg\bin-video\ffmpeg.exe -loglevel debug -probesize 1000000 -analyzeduration 10000000 -i D:\Movies\John Wick Chapter 3 Parabellum (2019)\John Wick Chapter 3 Parabellum.Remux-2160p.h265.TrueHD Atmos-7.1-OMEGA.mkv -vcodec libx265 -map 0:0 -pix_fmt yuv420p10le -crf 23 -maxrate:v 10m -bufsize 30m -metadata:s:v BPS=67268000 -metadata:s:v BPS-eng=67268000 -metadata:s:v title=4K HDR -profile:v main10 -level 5.2 -x265-params hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(34000,16000)B(7500,3000)R(13250,34500)WP(15635,16450)L(10,10000000):max-cll=1000,358 -tag:v hvc1 -c:a:0 copy -map 0:1 -metadata:s:a:0 title=7.1 Channel -metadata:s:a:0 language=eng -disposition:a:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -c:a:1 aac -map 0:1 -ac:a:1 2 -b:a:1 256k -metadata:s:a:1 BPS=256000 -metadata:s:a:1 BPS-eng=256000 -ar:a:1 48000 -metadata:s:a:1 title=Stereo -metadata:s:a:1 language=eng -disposition:a:1 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -strict experimental -f mp4 -threads 0 -metadata:g encoding_tool=SMA -strict experimental -max_muxing_queue_size 9999 -y D:\Movies\John Wick Chapter 3 Parabellum (2019)\John Wick Chapter 3 Parabellum.Remux-2160p.h265.TrueHD Atmos-7.1-OMEGA.mp4
2020-09-09 17:15:51 - MANUAL - INFO - ======================

@morpheus2n2
Copy link

So is it running now?

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

yes working slow as hell though, Quadro P2000 of no use now..
Screenshot (2)

@mdhiggins
Copy link
Owner

Good news though
You might be able to turn on at least hwaccel again, though I still think due to FFMPEG limitations you won't be able to use nvenc and preserve the framedata

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

Here it is running on my desktop
Screenshot (3)

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

But very good progress Gentleman.

Thank you guys for all your help.
🥇 👍
Only 122 TB left to convert now...about 8 mounts of 24/7 script running.

@mdhiggins
Copy link
Owner

hwaccel decoding should help some, but that is a massive amount of data

There's a bunch of patches proposed to fix ffmpeg in the future with hardware encoding and framedata so hopefully one of them will get merged. For such a large job it might even be worth it to try and build from source using those patches

Alternatively you could try nvenc and just confirm that the metadata doesn't work, if collisionincs solution ever worked with metadata and nvenc then maybe there's some way out there I'm not aware of

You could also just skip it and then use this tool to patch the metadata

https://github.com/SK-Hardwired/nv_hevc_hdr_patcher

@morpheus2n2
Copy link

I have HW Decoding just fine but the moment you use HW encoding you loose all metadata to do with HDR.
Avatar when I did it via a diffrent app (only to find I chose the wrong bloody audio stream so had to scrap it cos I don't understand Hindi) took 25 hours, and that's on a Ryzen 5 3600.

@Weezzel
Copy link
Author

Weezzel commented Sep 9, 2020

whats the best CRF Format to have on the top end for HDR?
0:17:4.5M:12M,4100:21:8M:24M, 8000:23:10M:30M

crf-profiles csv   Specify custom quality profiles based on input bitrate. Format is source_bitrate:CRF:maxrate:bufsize. Multiple profiles may be specified. If the source file's bitrate is greater than the source_bitrate that quality profile will be used. Example setting 0:17:4.5M:12M,4100:21:8M:24M,8000:23:10M:30M. With this setting if a video file with a bitrate of 5000 was used, the profile 4100:21:8M;24M would be used resulting in a CRF of 21, maxrate of 8M, and bufsize of 24M. These profiles override the simple single video-crf and video-bitrate setting

@mdhiggins
Copy link
Owner

Hm just noticed I have those crf-profile values backwards on that sample, and the crf should be going down as the source bitrate goes up. I just fixed that on the wiki

0:23:4.5M:12M,4100:21:8M:24M,8000:17:10M:30M

What CRF to use will depend on what kind of quality you want and how much storage you want. You can combine it with a preset value too.

Given that 4k HDR content will generally be high bitrate, then the highest profile will likely be used, so
8000:17:10M:30M

Here is a site with some info
https://write.corbpie.com/ffmpeg-h265-preset-crf-comparison-2020-pt1/

@Weezzel
Copy link
Author

Weezzel commented Sep 10, 2020

Preset=Fast
so where at in the string would I place the preset.

@mdhiggins
Copy link
Owner

I'll add a preset option but for now you can use preopts

@mdhiggins
Copy link
Owner

mdhiggins commented Sep 10, 2020

33cec84

dedicated preset option for standard or hdr

wiki updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants