Log in

View Full Version : HDR10+ General Discussion


Pages : 1 [2] 3

nevcairiel
4th February 2019, 10:58
The HDR10+ metadata references areas of the video, so if you scale or crop it (ie. change its size in any way), you would need to update the metadata accordingly.

quietvoid
4th February 2019, 13:03
I'm thinking it's all mostly based on luminance.
There's info about every luminance percentile for a frame and a value associated to it.
However I'm not sure what these values refer to, nor what Average Max RGB is about either.

jlpsvk
4th February 2019, 13:43
anyone know, how to update those metadata for cropped encode?

mini-moose
4th February 2019, 17:59
extract existing HDR-10+ dynamic data from a file (using hdr10plus_parser + ffmpeg, in case the video isn't available as raw video):)

How is it done with ffmpeg? Example would be much appreciated!

Selur
4th February 2019, 20:08
to output the data:
ffmpeg -i "E:\Output\HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe -
just to check whether dynamic data is present
ffmpeg -i "E:\Output\HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe - --verify

benwaggoner
5th February 2019, 00:54
anyone know, how to update those metadata for cropped encode?
If you cropped out any image data, it would need to be recalculated.

jlpsvk
5th February 2019, 10:23
If you cropped out any image data, it would need to be recalculated.

seems like a bad idea to crop and resize then. :) would stick with uncropped. :)

benwaggoner
5th February 2019, 13:05
seems like a bad idea to crop and resize then. :) would stick with uncropped. :)
Resizing is a low-pass filter, and can reduce peak brightness significantly if it is from small details like stars.

nevcairiel
5th February 2019, 13:18
Cropping alone wouldn't change the primary image information (assuming you only crop black bars). However, the metadata also references spatial windows in the image, which would get displaced if you crop, so those would at the very least need to be re-positioned.
Without proper tool support to do all of this, I would not bother trying to crop yet.

jlpsvk
5th February 2019, 13:45
yeah. :) i was meaning cropping, not resizing. :) so hdr10+ encodes without cropping for now. ;)

kolak
5th February 2019, 23:34
Resizing is a low-pass filter, and can reduce peak brightness significantly if it is from small details like stars.

Probably every video when measured for peak brightness should actually go through bit of low pass filtering. This is what some tools do (eg. Cortex).
1 pixel with 2K nits doesn't really mean much, does it?

mini-moose
6th February 2019, 02:02
to output the data:
ffmpeg -i "E:\Output\HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe -
just to check whether dynamic data is present
ffmpeg -i "E:\Output\HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe - --verify

Thanks!

hevc_mp4toannexb - does it need to be mp4 or can be mkv too?

halls
6th February 2019, 13:13
Hi, since HDR10+ titles started coming out I've been working on extracting the metadata from them.
For now the only purpose is to generate JSON files that x265 can use when reencoding these sources.

So I've made a tool which does just that, extracts the metadata and creates a compatible JSON file for x265.
It outputs a .log file with the raw bytes of every SEI message as well as a .json file with metadata formatted for HDR10+ LLC (not legacy).
HDR10+ LLC is what most current titles have been formatted like for now.

The tool is available on GitHub here: https://github.com/quietvoid/hdr10plus_parser
HDR10+ samples are available in the assets folder, they're also used for regression tests.

Hopefully this is useful for anyone wanting to retain HDR10+ after reencode as well as developers who have ideas about reusing the metadata on decode :)


Thank You!

Selur
6th February 2019, 15:17
hevc_mp4toannexb - does it need to be mp4 or can be mkv too?
the bitstream filter has nothing to do with the container, thus it doesn't matter whether the input is an mp4/mkv/m2ts/....

mini-moose
7th February 2019, 11:17
the bitstream filter has nothing to do with the container, thus it doesn't matter whether the input is an mp4/mkv/m2ts/....

I tried this:
ffmpeg -i "hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mkvtoannexb -f rawvideo - | hdr10plus_parser.exe - --verify

Unknown bitstream filter hevc_mkvtoannexb

and

ffmpeg -i "hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe - --verify

av_interleaved_write_frame(): Invalid argument
Error writing trailer of pipe:: Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 587kB time=00:00:00.00 bitrate=N/A speed=N/A
video:587kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 0.000000%
Conversion failed!

works fine with:
hdr10plus_parser.exe hdr10plus.sample_track1_[und].hevc

I'm probably something wrong. I'm not great with this, which is why I asked for an example :)

sneaker_ger
7th February 2019, 12:42
av_interleaved_write_frame(): Invalid argument
Error writing trailer of pipe:: Invalid argument
What does the line directly above it say? Maybe hdr10plus_parser aborts once it finds dynamic data while ffmpeg tries to send the whole stream?

kolak
7th February 2019, 13:52
ffmpeg -i "hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe - --verify

av_interleaved_write_frame(): Invalid argument
Error writing trailer of pipe:: Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 587kB time=00:00:00.00 bitrate=N/A speed=N/A
video:587kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 0.000000%
Conversion failed!


Looks like you simply use it wrongly:

fmpeg -i "input.mkv" -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser.exe -

from parser website as an example.

Source container should not matter. You use -vbsf hevc_mp4toannexb always and then -f hevc, not rawvideo. This command just extracts h265 elementary stream from container and passes to parser (without actually creating file). It's just shorter version of 2 stage process where you first create elementary h265 file from your source and then put it through parser.


update:

I just read it properly and rawvideo or hevc does the same in this case.

quietvoid
7th February 2019, 14:44
Using --verify does interrupt ffmpeg, but the error would be broken pipe.

Selur
7th February 2019, 16:23
When I call:
ffmpeg -i "e:\Output\with HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe - --verify
I get:

Parsing HEVC file for dynamic metadata...
ffmpeg version N-93064-ged20fbcd48 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (Rev1, Built by MSYS2 project) 20181214
configuration: --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --disable-debug --enable-ffnvcodec --enable-nvdec --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libaom --enable-version3 --enable-mbedtls --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 46.100 / 58. 46.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001cae4f52980] st: 0 edit list: 2 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001cae4f52980] st: 0 edit list 2 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'e:\Output\with HDR-10+.mp4':
Metadata:
major_brand : hev1
minor_version : 0
compatible_brands: iso4hev1
creation_time : 2019-02-03T13:36:13.000000Z
encoder : Hybrid 2019.02.02.1
Duration: 00:00:47.81, start: 0.000000, bitrate: 10657 kb/s
Stream #0:0(und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt709/unknown/unknown), 3840x2160 [SAR 1:1 DAR 16:9], 10410 kb/s, 24 fps, 24 tbr, 24k tbn, 24 tbc (default)
Metadata:
creation_time : 2019-02-03T13:36:13.000000Z
handler_name : 265#video:fps=24:delay=18@GPAC0.7.2-DEV-rev992-g4d4da2b20-ab-suite
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 255 kb/s (default)
Metadata:
creation_time : 2019-02-03T13:29:57.000000Z
Output #0, rawvideo, to 'pipe:':
Metadata:
major_brand : hev1
minor_version : 0
compatible_brands: iso4hev1
encoder : Lavf58.26.100
Stream #0:0(und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt709/unknown/unknown), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 10410 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
Metadata:
creation_time : 2019-02-03T13:36:13.000000Z
handler_name : 265#video:fps=24:delay=18@GPAC0.7.2-DEV-rev992-g4d4da2b20-ab-suite
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
Dynamic HDR10+ metadata detected.
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
frame= 1 fps=0.0 q=-1.0 Lsize= 32kB time=-00:00:00.04 bitrate=N/A speed=N/A
video:98kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

The important output here is the:
Dynamic HDR10+ metadata detected.

when calling:
ffmpeg -i "e:\Output\with HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe -
I get:
Parsing HEVC file for dynamic metadata...
ffmpeg version N-93064-ged20fbcd48 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (Rev1, Built by MSYS2 project) 20181214
configuration: --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --disable-debug --enable-ffnvcodec --enable-nvdec --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libaom --enable-version3 --enable-mbedtls --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 46.100 / 58. 46.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001029e292980] st: 0 edit list: 2 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001029e292980] st: 0 edit list 2 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'e:\Output\with HDR-10+.mp4':
Metadata:
major_brand : hev1
minor_version : 0
compatible_brands: iso4hev1
creation_time : 2019-02-03T13:36:13.000000Z
encoder : Hybrid 2019.02.02.1
Duration: 00:00:47.81, start: 0.000000, bitrate: 10657 kb/s
Stream #0:0(und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt709/unknown/unknown), 3840x2160 [SAR 1:1 DAR 16:9], 10410 kb/s, 24 fps, 24 tbr, 24k tbn, 24 tbc (default)
Metadata:
creation_time : 2019-02-03T13:36:13.000000Z
handler_name : 265#video:fps=24:delay=18@GPAC0.7.2-DEV-rev992-g4d4da2b20-ab-suite
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 255 kb/s (default)
Metadata:
creation_time : 2019-02-03T13:29:57.000000Z
Output #0, rawvideo, to 'pipe:':
Metadata:
major_brand : hev1
minor_version : 0
compatible_brands: iso4hev1
encoder : Lavf58.26.100
Stream #0:0(und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt709/unknown/unknown), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 10410 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
Metadata:
creation_time : 2019-02-03T13:36:13.000000Z
handler_name : 265#video:fps=24:delay=18@GPAC0.7.2-DEV-rev992-g4d4da2b20-ab-suite
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 1146 fps=127 q=-1.0 Lsize= 60682kB time=00:00:47.66 bitrate=10428.8kbits/s speed= 5.3x
video:60682kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Done.
Generating HDR10+ metadata JSON file... Done.

If you are not interessted in the ffmpeg output add '-loglevel quiet' and when calling:
ffmpeg -loglevel quiet -i "e:\Output\with HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe - --verify
you would just get:
Parsing HEVC file for dynamic metadata...
Dynamic HDR10+ metadata detected.

Cu Selur

benwaggoner
7th February 2019, 19:49
Probably every video when measured for peak brightness should actually go through bit of low pass filtering. This is what some tools do (eg. Cortex).
1 pixel with 2K nits doesn't really mean much, does it?
If you have bright blue stars in 4K RGB, the peak nits can be reduced a fair amount in a conversion to Y'CbCr 1080p. the brightest single pixel could come out with less than half the initial nits in some edge cases. Compression itself could reduce that farther.

The spec for static metadata (MaxFALL and MaxCLL) requires that the calculations be done in RGB, even though HDR content is always delivered in 4:2:0. It could be argued that metadata should be done based on the highest bitrate for the highest resolution encode, since that's the largest actual values you'd get, and more conservative values will allow more aggressive use of a panel's actual abilities.

However, tone mappers could theoretically use knowledge of the intended values to try to reconstruct those values in tone mapping. I don't know if any do it.

This stuff gets quickly complicated, which is why all good HDR tone mappers required the efforts of many PhDs. Clear specs on what the data is supposed to represent are so essential, and often much less obvious that it seems at first glance.

kolak
7th February 2019, 20:02
Yes, it's "slightly" bit more complex than it looks like.
Maybe this is why about every HDR tool reports different values for given source :)

mini-moose
10th February 2019, 11:12
When I call:
when calling:
ffmpeg -i "e:\Output\with HDR-10+.mp4" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | hdr10plus_parser.exe -
I get:

Generating HDR10+ metadata JSON file... Done.


Thanks. Don't know what is wrong but I still get the same results

"D:\hdr10plus_parser\ffmpeg.exe" -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" -

Gets me:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
av_interleaved_write_frame(): Invalid argument
Error writing trailer of pipe:: Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 587kB time=00:00:00.00 bitrate=N/A speed=N/A
video:587kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 0.000000%
Conversion failed!

with loglevel quite:
"D:\hdr10plus_parser\ffmpeg.exe" -loglevel quiet -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" -

I get: "Invalid file path."

kolak
10th February 2019, 11:28
Errors says: "Invalid file path.", so looks like parser not getting data.

Does this work:
"D:\hdr10plus_parser\ffmpeg.exe" -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f null -

mini-moose
10th February 2019, 12:47
Errors says: "Invalid file path.", so looks like parser not getting data.

Does this work:
"D:\hdr10plus_parser\ffmpeg.exe" -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f null -

this gives:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 3583 fps=0.0 q=-1.0 Lsize=N/A time=00:02:29.35 bitrate=N/A speed= 170x
video:821419kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: unknown

kolak
10th February 2019, 17:18
It worked fine, so there is some issue with piping part.
Try changing paths- just in case there is a typo etc.

quietvoid
10th February 2019, 21:15
Thanks. Don't know what is wrong but I still get the same results

"D:\hdr10plus_parser\ffmpeg.exe" -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" -

Gets me:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
av_interleaved_write_frame(): Invalid argument
Error writing trailer of pipe:: Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 587kB time=00:00:00.00 bitrate=N/A speed=N/A
video:587kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 0.000000%
Conversion failed!

with loglevel quite:
"D:\hdr10plus_parser\ffmpeg.exe" -loglevel quiet -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" -

I get: "Invalid file path."Both of the CLIs you quoted work for me.
Can you try updating to the latest release, 0.2.3 please? I've changed the whole input argument handling so maybe the errors get fixed.
Also which version of ffmpeg are you using? I've been testing using the Zeranoe FFmpeg builds.

This is what I tested with just now:
"ffmpeg.exe" -i ".\input.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | ".\hdr10plus_parser.exe" - -o ".\test.json"

mini-moose
11th February 2019, 10:34
Both of the CLIs you quoted work for me.
Can you try updating to the latest release, 0.2.3 please? I've changed the whole input argument handling so maybe the errors get fixed.
Also which version of ffmpeg are you using? I've been testing using the Zeranoe FFmpeg builds.

This is what I tested with just now:
"ffmpeg.exe" -i ".\input.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | ".\hdr10plus_parser.exe" - -o ".\test.json"

Using the static x64 build from zeranoe.

Now updated to the new hdr10plus_parser version and things are looking much better!

"D:\hdr10plus_parser\ffmpeg.exe" -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" - -o "D:\hdr10plus_parser\test.json"


result:
Reading parsed dynamic metadata... Done.
Writing metadata to JSON file... Done.

then:
"D:\hdr10plus_parser\ffmpeg.exe" -loglevel quiet -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" -
pause

result:
Parsing HEVC file for dynamic metadata...
Dynamic HDR10+ metadata detected.

but without specifying json save path:
"D:\hdr10plus_parser\ffmpeg.exe" -i "D:\hdr10plus_parser\hdr10plus.sample.mkv" -vcodec copy -an -sn -vbsf hevc_mp4toannexb -f rawvideo - | "D:\hdr10plus_parser\hdr10plus_parser.exe" -

result:
Dynamic HDR10+ metadata detected.
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe
frame= 1 fps=0.0 q=-1.0 Lsize= 32kB time=00:00:00.00 bitrate=N/A speed=N/A
video:587kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: unknown
Conversion failed!

Thanks!

Nico8583
6th September 2019, 15:26
Hi,
I'm trying to extract metadata with ffmpeg input, it seems to work but it's very slow, it is faster to extract HEVC stream then extract metadata from it but it writes a huge file.
Is it normal ffmpeg method is slower than extract then parse ?
Thank you.

quietvoid
7th September 2019, 04:08
Hi,
I'm trying to extract metadata with ffmpeg input, it seems to work but it's very slow, it is faster to extract HEVC stream then extract metadata from it but it writes a huge file.
Is it normal ffmpeg method is slower than extract then parse ?
Thank you.

It's single threaded but limited to I/O. It shouldn't be slow, and (probably) depends on your hard drive.
I can get 450 MB/s (1000 fps) parsing an MKV file with ffmpeg on an SSD.

Nico8583
7th September 2019, 08:41
It's single threaded but limited to I/O. It shouldn't be slow, and (probably) depends on your hard drive.
I can get 450 MB/s (1000 fps) parsing an MKV file with ffmpeg on an SSD.
Thank you, I get only 2 FPS when I use it (I use copy to video codec, I don't recode it).
Could you give me the ffmpeg version you use and the command line ? Thank you.

quietvoid
7th September 2019, 16:10
Thank you, I get only 2 FPS when I use it (I use copy to video codec, I don't recode it).
Could you give me the ffmpeg version you use and the command line ? Thank you.

Zeranoe FFmpeg builds should work, there's an example CLI:
ffmpeg -i "input.mkv" -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser.exe -

Nico8583
9th September 2019, 14:02
Thank you, I just replaced an old ffmpeg with the newest version and now I get 500 fps instead of 50 fps...

mini-moose
24th September 2019, 17:31
double post by mistake. can be deleted.

mini-moose
24th September 2019, 17:50
hi quietvoid

I was playing around with a recent hdr10+ disc I got.

The tool dialog added something called "Mastering peak flag enabled":
Parsing HEVC file for dynamic metadata...
[00:02:25] 100%
Reading parsed dynamic metadata... Mastering peak flag enabled
Mastering peak flag enabled
Mastering peak flag enabled
Mastering peak flag enabled
Mastering peak flag enabled
Done.
Writing metadata to JSON file... Done.
the "Mastering peak flag enabled" repeats about 40-50 times.

Then I tried to serve the json to x265 and encode the vid.
Looked at the MediaInfo report and it shows just this:
HDR format : SMPTE ST 2094 App 4, Version 1

On previous encodes I did show up like this:
HDR format : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile A compatible
or
HDR format : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
From the little I understand, it appears it can't recognize it as hdr10+

quietvoid
24th September 2019, 18:40
hi quietvoid

I was playing around with a recent hdr10+ disc I got.

The tool dialog added something called "Mastering peak flag enabled":
Parsing HEVC file for dynamic metadata...
[00:02:25] 100%
Reading parsed dynamic metadata... Mastering peak flag enabled
Mastering peak flag enabled
Mastering peak flag enabled
Mastering peak flag enabled
Mastering peak flag enabled
Done.
Writing metadata to JSON file... Done.
the "Mastering peak flag enabled" repeats about 40-50 times.

Then I tried to serve the json to x265 and encode the vid.
Looked at the MediaInfo report and it shows just this:
HDR format : SMPTE ST 2094 App 4, Version 1

On previous encodes I did show up like this:
HDR format : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile A compatible
or
HDR format : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
From the little I understand, it appears it can't recognize it as hdr10+ Hi, thanks for the feedback.

That part of the metadata was not implemented, I can't remember whether it was in the specs sheet I was using.

If it was, I did note that it was not supposed to be enabled in the version's specs.

So it is possible there is a new version of the spec, where some of these flags are actually being used now.

I had received some feedback regarding a disc failing to parse recently, but I have not had the time to look into it.
Can you share the title? If I remember correctly it was Shaun of the Dead.

Thanks.

Edit: I have done a bit of research and it seems the HDR10+ LLC alliance has published a press release on 2019/09/04.

Released this month is an updated Technical Specification to respond to industry’s request of new device categories and codecs as well as a comprehensive whitepaper to introduce the technology and it’s benefit to new adopters

So there's likely no access for now, even x265 will likely need to update their implementation.

mini-moose
24th September 2019, 19:51
I had received some feedback regarding a disc failing to parse recently, but I have not had the time to look into it.
Can you share the title? If I remember correctly it was Shaun of the Dead.

Thanks.

Edit: I have done a bit of research and it seems the HDR10+ LLC alliance has published a press release on 2019/09/04.


I figured out the issue with x265, but like you said, the json made with this new hdr10+ profile may not have all that is required to work properly.

quietvoid
27th September 2019, 22:19
I figured out the issue with x265, but like you said, the json made with this new hdr10+ profile may not have all that is required to work properly.Turns out your issue was an edge case. :D

Updated the parser to 0.2.4
Fix edge case when AverageRGB, MaxScl are 0 but not targeted_system_display_maximum_luminance.
Add asserts to avoid invalid data.
Error when the dynamic metadata is from a (possibly) unsupported version.
https://github.com/quietvoid/hdr10plus_parser/releases

mini-moose
28th September 2019, 12:25
Turns out your issue was an edge case. :D

Updated the parser to 0.2.4

https://github.com/quietvoid/hdr10plus_parser/releases

thanks for the update!

Edge case you mean why I couldn't get x265 to identify hd10+ without cutting out the first second?

quietvoid
28th September 2019, 13:47
thanks for the update!

Edge case you mean why I couldn't get x265 to identify hd10+ without cutting out the first second?The edge case was present in the first second so the JSON was most likely invalid for the first second.
So now if the parser doesn't error, the metadata should be valid.

PapitaHD
10th November 2019, 09:42
Hi all,
First of all let me thank quietvoid for the hdr10+ parser, works great and very easy to use!
My only issue is the same that mini-moose mentioned a few posts back. I'm trying to encode the quite recent American Gangster BD which has hdr10+. I used the parser as advised to get the json file with the metadata, but after encoding the movie, the resulted file doesn't have the hdr10+ flag in mediainfo. It shows: SMPTE ST 2094 App 4.
What can be the issue, maybe the parser needs another update?
Thanks in advance! :)

quietvoid
20th November 2019, 20:42
Sorry, I hadn't seen your post.
As far as I'm aware, HDR10+ is a format in conformance with SMPTE ST 2094 App 4.

MediaInfo sometimes includes a HDR10+ profile compatibility, but I have no idea what they mean.
The "HDR10+ profile A/B compatible" flag seems to be lost after reencode sometimes, however the presence of ST2094 App 4 metadata is still detected.
It mostly happens with titles released after the September 4 2019 specifications release.

If anyone has information regarding the HDR10+ profiles, it would be useful.
Otherwise I don't really know what is missing for HDR10+ profiles compatibility.

mini-moose
20th November 2019, 21:26
MediaInfo sometimes includes a HDR10+ profile compatibility, but I have no idea what they mean.
The "HDR10+ profile A/B compatible" flag seems to be lost after reencode sometimes, however the presence of ST2094 App 4 metadata is still detected.
It mostly happens with titles released after the September 4 2019 specifications release.

Maybe another edge case like mine had?

quietvoid
20th November 2019, 22:46
Well, the metadata gets parsed correctly.
There might be some data missing (in the JSON or after x265's encode) but without the new specifications or an updated example JSON I don't know what the difference would be.

quietvoid
21st November 2019, 07:25
Sorry for the double post.
I've tested with the x265 example and it always has HDR10+ Profile B compatible.
Turns out it's not being flagged if there is no BezierCurveData object in the JSON.
So added it (it used to only be added when there is actual data for it), and refactored the code to be more readable. Also improved the JSON to be properly generated.

Fixed the cargo run not working, tested that all the input/output arguments work just like before. Hopefully nothing breaks.

Updated to 0.2.5
https://github.com/quietvoid/hdr10plus_parser/releases

PapitaHD
21st November 2019, 22:27
Thanks a lot, it's working perfeclty now!
I encoded The Shining and American Gangster with hdr10+ successfully and I'm gonna test it on Ad Astra as soon as it's out.

quietvoid
22nd November 2019, 01:09
Further more, I just stumbled across this in the September 2019 White Paper from https://hdr10plus.org/wp-content/uploads/2019/08/HDR10_WhitePaper.pdf
No matter the workflow used, HDR10+ technology can support the full range of HDR standards to 10,000 cd/m2, 8K and BT.2020 color gamut.
Being resolution agnostic, metadata needs to be created only once and can be applied to any target resolution.So it seems there should be no problem with cropping and/or resizing.

nevcairiel
22nd November 2019, 01:16
So it seems there should be no problem with cropping and/or resizing.

Actually with cropping you would need to adjust the metadata, but resizing should be fine, as long as the relative dimensions and aspect ratio stay the same (but to change that you would probably crop anyway).

quietvoid
22nd November 2019, 03:06
Actually with cropping you would need to adjust the metadata, but resizing should be fine, as long as the relative dimensions and aspect ratio stay the same (but to change that you would probably crop anyway).

I still think there's nothing relevant to the resolution/aspect ratio in the current version.
The Bezier curve data specifies info for the curve generation only.
The processing windows (which do mention pixel coordinates) are not in this version.
The only thing that might need adjustment is the average/max RGB values if they were calculated with the black bars not accounted for.

Unless I'm missing something..

nevcairiel
22nd November 2019, 09:45
Oh, I didn't check what might be in there, I only remember from implementing HEVC metadata parsing that it contains the processing windows - on second thought they would probably also need adjustment for scaling, but thats easier since you just have to scale their coordinates.
But even then, resizing the processing windows is trivial, what the Whitepaper refers to would indicate actually having to determine full new metadata, which can be avoided that way.

jlpsvk
31st December 2019, 16:26
just a question... shoudn't be then all HDR video encoded without cropping? average CLL and MAX-CLL are calculated with the black bars, if I am right. so without it, it could cause playing somehow different, as with black bars... it's just my quess...