quietvoid / hdr10plus_tool

CLI utility to work with HDR10+ in HEVC files.
MIT License
288 stars 33 forks source link

HDR10+ metadata not loading #9

Closed iykkim closed 4 years ago

iykkim commented 5 years ago

Hi. Thanks for your works for this nice utility. By the way, I have a problem for getting HDR10+ metadata. I can see from Mediainfo tool (I'm using latest v19.04), it's HDR10+ video file but HDR10plus_parser didn't recognize it and don't getting HDR10+ metadata.. I made a short sample clip of this video and uploaded below OneDrive share;

https://1drv.ms/f/s!ApSX3ujJA5Tvgowsto7h_-ODYjTedw

Mediainfo indicating this video as, HDR_Format/String : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile A compatible

But HDR10+plus_parser is complete as "File doesn't contain dynamic metadata"

Please have a look at it and thanks again.

quietvoid commented 5 years ago

I remuxed your sample with MKVToolNix and it works using ffmpeg -i sample.mkv -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser.exe -

Outputs Dynamic HDR10+ metadata detected. I'll have to look into why the elementary stream isn't being detected properly.

iykkim commented 5 years ago

As you said, I also getting detected via ffmpeg pipe output so I did below commands;

ffmpeg -i "Alita- sample.hevc" -c:v copy -vbsf hevc_mp4toannexb -f hevc tmp.hevc
hdr10plus_parser -i tmp.hevc -o .\meta.json

Now I got json file for HDR10+ :) Thanks and hope direct usage without ffmpeg pipe doing well too.

quietvoid commented 4 years ago

@iykkim Okay, I finally got the time to look into this and found the issue pretty quickly. Your sample HEVC file has an embedded image which is 98 453 bytes.

The tool only uses the first 100 000 bytes chunk to verify if there is metadata in the bitstream, so it is very likely that there was no SEI message in the remaining 1500 bytes before it fails. That's assuming the attachments are at the beginning of the stream.

I'm not going to fix this because embedded attachments can be any size.

To have the sample detected properly, I remuxed with MKVToolNix and demuxed with gMKVExtractGUI. That way the elementary stream and the attachments are properly separated. Then running hdr10plus_parser.exe .\demuxed.hevc

Outputs Dynamic HDR10+ metadata detected.

So, don't embed anything into the elementary stream :)